my-ai-api / app.py
V1oris's picture
Create app.py
dbb5c2c verified
raw
history blame contribute delete
535 Bytes
from fastapi import FastAPI, File, UploadFile, Form
from fastapi.middleware.cors import CORSMiddleware
app = FastAPI()
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_methods=["*"],
allow_headers=["*"],
)
@app.get("/")
def root():
return {"status": "ok"}
@app.post("/v1/chat")
async def chat(
text: str = Form(""),
image: UploadFile = File(None),
audio: UploadFile = File(None),
video: UploadFile = File(None),
):
# Your AI logic here
return {"reply": f"You said: {text}"}