Jeffrey0216 commited on
Commit
047d85e
·
verified ·
1 Parent(s): e2a742f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -7,14 +7,14 @@ classifier = pipeline(
7
  )
8
 
9
  def predict(text):
10
- result = classifier(text)
11
- return result[0]["label"]
12
 
13
  with gr.Blocks() as demo:
14
  gr.Markdown("# Sentiment Analysis")
15
- text = gr.Textbox(label="Enter text")
16
- output = gr.Textbox(label="Sentiment")
17
  btn = gr.Button("Analyze")
18
- btn.click(fn=predict, inputs=text, outputs=output)
 
 
19
 
20
- demo.launch()
 
7
  )
8
 
9
  def predict(text):
10
+ return classifier(text)[0]["label"]
 
11
 
12
  with gr.Blocks() as demo:
13
  gr.Markdown("# Sentiment Analysis")
14
+ inp = gr.Textbox(label="Enter text")
15
+ out = gr.Textbox(label="Sentiment")
16
  btn = gr.Button("Analyze")
17
+ btn.click(predict, inp, out)
18
+
19
+ demo.launch(server_name="0.0.0.0", server_port=7860)
20