23 lines
486 B
Python
23 lines
486 B
Python
|
from fastapi import FastAPI
|
||
|
from pydantic import BaseModel
|
||
|
import convertir_point_median as cpm
|
||
|
|
||
|
app = FastAPI()
|
||
|
|
||
|
|
||
|
class TranslationRequest(BaseModel):
|
||
|
text: str
|
||
|
|
||
|
|
||
|
class TranslationResponse(BaseModel):
|
||
|
text: str
|
||
|
|
||
|
|
||
|
@app.get("/corriger")
|
||
|
def translate(request: TranslationRequest):
|
||
|
# Implement Point-Median algorithm here
|
||
|
texte = request.text
|
||
|
texte_corrige = cpm.convertir_point_median(texte)
|
||
|
response = TranslationResponse(text=texte_corrige)
|
||
|
return response
|