Tirath5504 commited on
Commit
abb6d70
1 Parent(s): 07459be

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -10
app.py CHANGED
@@ -12,13 +12,10 @@ 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 of Hinglish Text")
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.Interface(
16
+ fn=classify_text,
17
+ inputs=[gr.Textbox(label="Input Text"), gr.Button("Classify")],
18
+ outputs=[gr.Textbox(label="Predicted Label"), gr.Number(label="Prediction Score")],
19
+ live=False
20
+ ) as demo:
21
+ demo.launch()