rasouzadev commited on
Commit
61f964e
·
verified ·
1 Parent(s): 72b6778

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -12
app.py CHANGED
@@ -51,18 +51,32 @@ def classify(text: str) -> Dict[str, Any]:
51
  "note": None
52
  }
53
 
54
- demo = gr.Interface(
55
- fn=classify,
56
- inputs=gr.Textbox(label="Texto para classificar", placeholder="Digite o texto aqui..."),
57
- outputs=gr.JSON(label="Resultado"),
58
- title="MedGo - Intent & Hate Detector API",
59
- description="API para classificação de intenção e detecção de hate speech",
60
- examples=[
61
- ["Preciso marcar uma consulta"],
62
- ["Você é um idiota!"],
63
- ],
64
- api_name="predict"
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()