Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -51,18 +51,32 @@ def classify(text: str) -> Dict[str, Any]:
|
|
| 51 |
"note": None
|
| 52 |
}
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
if __name__ == "__main__":
|
| 68 |
demo.launch()
|
|
|
|
| 51 |
"note": None
|
| 52 |
}
|
| 53 |
|
| 54 |
+
with gr.Blocks(title="MedGo - Intent & Hate Detector API") as demo:
|
| 55 |
+
gr.Markdown("# MedGo - Intent & Hate Detector API")
|
| 56 |
+
gr.Markdown("API para classificação de intenção e detecção de hate speech")
|
| 57 |
+
|
| 58 |
+
with gr.Row():
|
| 59 |
+
with gr.Column():
|
| 60 |
+
text_input = gr.Textbox(
|
| 61 |
+
label="Texto para classificar",
|
| 62 |
+
placeholder="Digite o texto aqui...",
|
| 63 |
+
lines=3
|
| 64 |
+
)
|
| 65 |
+
submit_btn = gr.Button("Classificar", variant="primary")
|
| 66 |
+
|
| 67 |
+
with gr.Column():
|
| 68 |
+
output_json = gr.JSON(label="Resultado")
|
| 69 |
+
|
| 70 |
+
gr.Examples(
|
| 71 |
+
examples=[
|
| 72 |
+
["Preciso marcar uma consulta"],
|
| 73 |
+
["Qual é o horário de atendimento?"],
|
| 74 |
+
["Você é um idiota!"],
|
| 75 |
+
],
|
| 76 |
+
inputs=text_input
|
| 77 |
+
)
|
| 78 |
+
|
| 79 |
+
submit_btn.click(fn=classify, inputs=text_input, outputs=output_json, api_name="predict")
|
| 80 |
|
| 81 |
if __name__ == "__main__":
|
| 82 |
demo.launch()
|