lunadebruyne commited on
Commit
31fe7d7
·
1 Parent(s): 2ed293a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -14
app.py CHANGED
@@ -109,23 +109,31 @@ def inference_sentence(text):
109
  output = "This sentence will be processed:\n" + text
110
  return output
111
 
112
- def inference_dataset(input_file, input_checks):
113
  output1="Here you will be able to download a file."
114
  output2 = output3 = output4 = output5 = "This option was not selected."
115
  if "emotion frequencies" in input_checks:
116
- output2 = gr.Textbox(value="This option was selected.", visible=True)
117
- #output2 = "This option was selected."
118
  if "emotion distribution over time" in input_checks:
119
- output3 = gr.Textbox(value="This option was selected.", visible=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  if "peaks" in input_checks:
121
- output4 = gr.Textbox(value="This option was selected.", visible=True)
122
  if "topics" in input_checks:
123
- output5 = gr.Textbox(value="This option was selected.", visible=True)
124
- return {output1,
125
- output2,
126
- output3,
127
- output4,
128
- output5}
129
 
130
 
131
  with gr.Blocks() as demo:
@@ -156,12 +164,13 @@ with gr.Blocks() as demo:
156
  label = "Select options")
157
  send_btn = gr.Button("Send")
158
  with gr.Column():
159
- output_file = gr.Textbox()
160
  output_plot = gr.Textbox(visible=False)
161
  output_dist = gr.Textbox(visible=False)
162
  output_peaks = gr.Textbox(visible=False)
163
  output_topics = gr.Textbox(visible=False)
164
- send_btn.click(fn=inference_dataset, inputs=[input_file,input_checks], outputs=[output_file,output_plot,output_dist,output_peaks,output_topics])
165
-
 
166
  demo.launch()
167
 
 
109
  output = "This sentence will be processed:\n" + text
110
  return output
111
 
112
+ def inference_dataset1(input_file, input_checks):
113
  output1="Here you will be able to download a file."
114
  output2 = output3 = output4 = output5 = "This option was not selected."
115
  if "emotion frequencies" in input_checks:
116
+ output2 = "This option was selected."
 
117
  if "emotion distribution over time" in input_checks:
118
+ output3 = "This option was selected."
119
+ if "peaks" in input_checks:
120
+ output4 = "This option was selected."
121
+ if "topics" in input_checks:
122
+ output5 = "This option was selected."
123
+ return {output_file: gr.update(value=output1, visible=True)
124
+
125
+ def inference_dataset1(input_file, input_checks):
126
+ output1="Here you will be able to download a file."
127
+ output2 = output3 = output4 = output5 = "This option was not selected."
128
+ if "emotion frequencies" in input_checks:
129
+ output2 = "This option was selected."
130
+ if "emotion distribution over time" in input_checks:
131
+ output3 = "This option was selected."
132
  if "peaks" in input_checks:
133
+ output4 = "This option was selected."
134
  if "topics" in input_checks:
135
+ output5 = "This option was selected."
136
+ return {output_plot: gr.update(value=output2, visible=True)
 
 
 
 
137
 
138
 
139
  with gr.Blocks() as demo:
 
164
  label = "Select options")
165
  send_btn = gr.Button("Send")
166
  with gr.Column():
167
+ output_file = gr.Textbox(visible=False)
168
  output_plot = gr.Textbox(visible=False)
169
  output_dist = gr.Textbox(visible=False)
170
  output_peaks = gr.Textbox(visible=False)
171
  output_topics = gr.Textbox(visible=False)
172
+ send_btn.click(fn=inference_dataset1, inputs=[input_file,input_checks], outputs=[output_file,output_plot,output_dist,output_peaks,output_topics])
173
+ output_file.change(fn=inference_dataset2, inputs=[input_file,input_checks], outputs=[output_file,output_plot,output_dist,output_peaks,output_topics])
174
+
175
  demo.launch()
176