Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -66,11 +66,13 @@ async def classify_emotion(text: str) -> dict:
|
|
| 66 |
@app.post("/analyze")
|
| 67 |
async def analyze_text(input: TextInput):
|
| 68 |
text = input.text.strip()
|
| 69 |
-
# Detecta se precisa traduzir (acentos comuns do português)
|
| 70 |
if any(c in text for c in "áéíóúãõâêôçà"):
|
| 71 |
text_en = await translate_to_english(text)
|
| 72 |
else:
|
| 73 |
text_en = text
|
| 74 |
-
|
| 75 |
return await classify_emotion(text_en)
|
| 76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
@app.post("/analyze")
|
| 67 |
async def analyze_text(input: TextInput):
|
| 68 |
text = input.text.strip()
|
|
|
|
| 69 |
if any(c in text for c in "áéíóúãõâêôçà"):
|
| 70 |
text_en = await translate_to_english(text)
|
| 71 |
else:
|
| 72 |
text_en = text
|
|
|
|
| 73 |
return await classify_emotion(text_en)
|
| 74 |
|
| 75 |
+
# Endpoint simples para verificar se está rodando
|
| 76 |
+
@app.get("/")
|
| 77 |
+
async def root():
|
| 78 |
+
return {"status": "ok", "message": "API de análise emocional rodando 🚀"}
|