Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI
|
| 2 |
+
from pydantic import BaseModel
|
| 3 |
+
|
| 4 |
+
app = FastAPI()
|
| 5 |
+
|
| 6 |
+
class Chat(BaseModel):
|
| 7 |
+
message: str
|
| 8 |
+
|
| 9 |
+
@app.get("/")
|
| 10 |
+
def root():
|
| 11 |
+
return {"status": "ZenkaMind test API çalışıyor"}
|
| 12 |
+
|
| 13 |
+
@app.get("/health")
|
| 14 |
+
def health():
|
| 15 |
+
return {"ok": True}
|
| 16 |
+
|
| 17 |
+
@app.post("/api/chat")
|
| 18 |
+
def chat(data: Chat):
|
| 19 |
+
return {
|
| 20 |
+
"response": f"Mesaj alındı: {data.message}"
|
| 21 |
+
}
|