lunadebruyne commited on
Commit
c820969
·
1 Parent(s): bc251bf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -21
app.py CHANGED
@@ -149,21 +149,20 @@ def inference_dataset5(input_file, input_checks):
149
  return gr.update(value="This option was not selected.")
150
  """
151
 
152
- def file(input_file):
153
  output = "output.txt"
154
  f = open(output, 'w')
155
  f.write("The predictions come here.")
156
  f.close()
157
- return gr.update(value=output, visible=True)
 
 
 
 
 
 
 
158
 
159
- def file_next(input_file):
160
- output = "output.txt"
161
- f = open(output, 'w')
162
- f.write("The predictions come here.")
163
- f.close()
164
- return gr.update(value=output, visible=True), gr.update(visible=True) # next_button becomes available
165
-
166
-
167
 
168
 
169
  with gr.Blocks() as demo:
@@ -209,17 +208,7 @@ with gr.Blocks() as demo:
209
  output_topics = gr.Textbox(label="Topics", visible=False)
210
 
211
  #send_btn.click(fn=inference_dataset1, inputs=input_file, outputs=[output_file,next_button_freq]) # next_button_freq becomes visible
212
-
213
- if "emotion frequencies" in input_checks:
214
- send_btn.click(fn=file_next, inputs=input_file, outputs=[output_file,next_button_freq]) # next_button_freq becomes visible
215
- elif "emotion distribution over time" in input_checks:
216
- send_btn.click(fn=file_next, inputs=input_file, outputs=[output_file,next_button_dist]) # next_button_dist becomes visible
217
- elif "peaks" in input_checks:
218
- send_btn.click(fn=file_next, inputs=input_file, outputs=[output_file,next_button_peaks]) # next_button_peaks becomes visible
219
- elif "topics" in input_checks:
220
- send_btn.click(fn=file_next, inputs=input_file, outputs=[output_file,next_button_topics]) # next_button_topics becomes visible
221
- else:
222
- send_btn.click(fn=file, inputs=input_file, outputs=output_file) # no next_button becomes available
223
 
224
  """"
225
  if "emotion frequencies" in input_checks:
 
149
  return gr.update(value="This option was not selected.")
150
  """
151
 
152
+ def file(input_file, input_checks):
153
  output = "output.txt"
154
  f = open(output, 'w')
155
  f.write("The predictions come here.")
156
  f.close()
157
+ if "emotion frequencies" in input_checks:
158
+ return gr.update(value=output, visible=True), gr.update(visible=True), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False) # next_button_freq becomes available
159
+ elif "emotion distribution over time" in input checks:
160
+ return gr.update(value=output, visible=True), gr.update(visible=False), gr.update(visible=True), gr.update(visible=False), gr.update(visible=False) # next_button_dist becomes available
161
+ elif "peaks" in input checks:
162
+ return gr.update(value=output, visible=True), gr.update(visible=False), gr.update(visible=False), gr.update(visible=True), gr.update(visible=False) # next_button_peaks becomes available
163
+ elif "topics" in input checks:
164
+ return gr.update(value=output, visible=True), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=True) # next_button_peaks becomes available
165
 
 
 
 
 
 
 
 
 
166
 
167
 
168
  with gr.Blocks() as demo:
 
208
  output_topics = gr.Textbox(label="Topics", visible=False)
209
 
210
  #send_btn.click(fn=inference_dataset1, inputs=input_file, outputs=[output_file,next_button_freq]) # next_button_freq becomes visible
211
+ send_btn.click(fn=file, inputs=input_file, outputs=[output_file,next_button_freq,next_button_dist,next_button_peaks,next_button_topics])
 
 
 
 
 
 
 
 
 
 
212
 
213
  """"
214
  if "emotion frequencies" in input_checks: