Tirath5504 commited on
Commit
74c6c38
1 Parent(s): 06b3035

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -8
app.py CHANGED
@@ -12,13 +12,22 @@ def classify_text(text):
12
  result = classifier(text)
13
  return result[0]['label'], result[0]['score']
14
 
15
- with gr.Blocks() as demo:
16
- gr.Markdown("# Hate Speech Classification with Fine-Tuned Model")
17
- with gr.Row():
18
- text_input = gr.Textbox(label="Input Text")
19
- label_output = gr.Textbox(label="Predicted Label")
20
- score_output = gr.Number(label="Prediction Score")
21
 
22
- text_input.change(fn=classify_text, inputs=text_input, outputs=[label_output, score_output])
23
 
24
- demo.launch()
 
 
 
 
 
 
 
 
 
 
12
  result = classifier(text)
13
  return result[0]['label'], result[0]['score']
14
 
15
+ # with gr.Blocks() as demo:
16
+ # gr.Markdown("# Hate Speech Classification with Fine-Tuned Model")
17
+ # with gr.Row():
18
+ # text_input = gr.Textbox(label="Input Text")
19
+ # label_output = gr.Textbox(label="Predicted Label")
20
+ # score_output = gr.Number(label="Prediction Score")
21
 
22
+ # text_input.change(fn=classify_text, inputs=text_input, outputs=[label_output, score_output])
23
 
24
+ # demo.launch()
25
+
26
+ iface = gr.Interface(
27
+ fn=classify_text,
28
+ inputs=gr.Textbox(label="Input Text"),
29
+ outputs=[gr.Textbox(label="Predicted Label"), gr.Number(label="Prediction Score")],
30
+ title="Hate Speech Classification with Fine-Tuned Model"
31
+ )
32
+
33
+ iface.launch()