File size: 391 Bytes
0b84e95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from pydantic import BaseModel
from fastapi import FastAPI


# Initialize FastAPI app
app = FastAPI(title="PDF Data Extraction")

class Item(BaseModel):
    name: str
    description: str = None

@app.post("/predict/")
async def predict(item: Item):
    return {"result": f"Vous avez envoyé : {item.name}"}

@app.get("/")
async def root():
    return {"message": "Bienvenue sur mon API !"}