Spaces:
Runtime error
Runtime error
Commit ·
e72395f
1
Parent(s): 6e0814e
Add application file
Browse files
app.py
CHANGED
|
@@ -1,7 +1,20 @@
|
|
| 1 |
from fastapi import FastAPI
|
|
|
|
| 2 |
|
| 3 |
-
app = FastAPI()
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
@app.get("/")
|
| 6 |
-
def
|
| 7 |
-
return {"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
+
from pydantic import BaseModel
|
| 3 |
|
| 4 |
+
app = FastAPI(title="Sentimind API")
|
| 5 |
+
|
| 6 |
+
class InputText(BaseModel):
|
| 7 |
+
text: str
|
| 8 |
|
| 9 |
@app.get("/")
|
| 10 |
+
def root():
|
| 11 |
+
return {"message": "Hello from Sentimind API!"}
|
| 12 |
+
|
| 13 |
+
@app.post("/predict")
|
| 14 |
+
def predict(input_data: InputText):
|
| 15 |
+
# Dummy prediction
|
| 16 |
+
return {
|
| 17 |
+
"input_text": input_data.text,
|
| 18 |
+
"sentiment": "positive",
|
| 19 |
+
"confidence": 0.95
|
| 20 |
+
}
|