Spaces:
Sleeping
Sleeping
| from fastapi import FastAPI | |
| from .cleaner import clean_subtitle | |
| from .model import get_model | |
| from .schemas import EmotionResponse, SubtitleRequest | |
| app = FastAPI(title="Emotion Analyzer API") | |
| async def root(): | |
| return {"status": "ok"} | |
| async def analyze(req: SubtitleRequest): | |
| model = get_model() | |
| text = clean_subtitle(req.text) | |
| df = model.analyze_text(text) | |
| return EmotionResponse( | |
| data=df.to_dict(orient="records") | |
| ) |