Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pydantic import BaseModel
|
| 2 |
+
from fastapi import FastAPI
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
# Initialize FastAPI app
|
| 6 |
+
app = FastAPI(title="PDF Data Extraction")
|
| 7 |
+
|
| 8 |
+
class Item(BaseModel):
|
| 9 |
+
name: str
|
| 10 |
+
description: str = None
|
| 11 |
+
|
| 12 |
+
@app.post("/predict/")
|
| 13 |
+
async def predict(item: Item):
|
| 14 |
+
return {"result": f"Vous avez envoyé : {item.name}"}
|
| 15 |
+
|
| 16 |
+
@app.get("/")
|
| 17 |
+
async def root():
|
| 18 |
+
return {"message": "Bienvenue sur mon API !"}
|