Spaces:
Sleeping
Sleeping
added root path
Browse files- app/main.py +5 -0
app/main.py
CHANGED
|
@@ -26,6 +26,11 @@ le.classes_ = np.load("app/label_classes.npy", allow_pickle=True)
|
|
| 26 |
class TextInput(BaseModel):
|
| 27 |
text: str
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
@app.post("/predict")
|
| 30 |
async def predict(data: TextInput):
|
| 31 |
inputs = tokenizer(data.text, return_tensors="pt", truncation=True, padding=True)
|
|
|
|
| 26 |
class TextInput(BaseModel):
|
| 27 |
text: str
|
| 28 |
|
| 29 |
+
@app.get("/")
|
| 30 |
+
def read_root():
|
| 31 |
+
return {"message": "FastAPI backend is live. Go to /docs to test."}
|
| 32 |
+
|
| 33 |
+
|
| 34 |
@app.post("/predict")
|
| 35 |
async def predict(data: TextInput):
|
| 36 |
inputs = tokenizer(data.text, return_tensors="pt", truncation=True, padding=True)
|