dar-tau commited on
Commit
822923c
·
verified ·
1 Parent(s): b3d4e85

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -24,9 +24,16 @@ def analyze_sentence(index):
24
  plt.ylabel('TARGET')
25
  plt.xlabel('SOURCE')
26
  plt.grid()
27
- return text, fig
28
 
 
 
 
 
 
 
 
29
 
30
- iface = gr.Interface(fn=analyze_sentence, inputs=[gr.Dropdown(choices=dataset['text'], value=0, type='index')],
31
- outputs=[gr.Label(), gr.Plot(label="Plot")])
32
- iface.launch()
 
24
  plt.ylabel('TARGET')
25
  plt.xlabel('SOURCE')
26
  plt.grid()
27
+ return fig
28
 
29
+ demo = gr.Blocks()
30
+ with demo:
31
+ with gr.Row():
32
+ dropdown = gr.Dropdown(choices=dataset['text'], value=0, type='index')
33
+ btn = gr.Button("Run")
34
+ output = gr.Plot(label="Plot")
35
+ btn.click(fn=analyze_sentence, [dropdown], [output])
36
 
37
+
38
+ if __name__ == "__main__":
39
+ demo.launch()