Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,15 +1,24 @@
|
|
| 1 |
from fastapi import FastAPI
|
|
|
|
| 2 |
|
| 3 |
-
app = FastAPI()
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
@app.get("/")
|
| 6 |
def read_root():
|
| 7 |
-
return {"
|
| 8 |
|
| 9 |
@app.get("/test")
|
| 10 |
def test():
|
| 11 |
return {"message": "Test endpoint working!"}
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
# This will run when you use: python app.py
|
| 14 |
if __name__ == "__main__":
|
| 15 |
import uvicorn
|
|
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
+
from pydantic import BaseModel
|
| 3 |
|
| 4 |
+
app = FastAPI(title="Quiz Guru Chatbot", version="1.0.0")
|
| 5 |
+
|
| 6 |
+
class PromptRequest(BaseModel):
|
| 7 |
+
prompt: str
|
| 8 |
|
| 9 |
@app.get("/")
|
| 10 |
def read_root():
|
| 11 |
+
return {"message": "Quiz Guru Chatbot API", "status": "running"}
|
| 12 |
|
| 13 |
@app.get("/test")
|
| 14 |
def test():
|
| 15 |
return {"message": "Test endpoint working!"}
|
| 16 |
|
| 17 |
+
@app.post("/predict")
|
| 18 |
+
def predict(request: PromptRequest):
|
| 19 |
+
# For now, just echo back - we'll add the model next
|
| 20 |
+
return {"result": f"Echo: {request.prompt}", "status": "working"}
|
| 21 |
+
|
| 22 |
# This will run when you use: python app.py
|
| 23 |
if __name__ == "__main__":
|
| 24 |
import uvicorn
|