lunadebruyne commited on
Commit
b0f937c
Β·
1 Parent(s): 1eea227

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -116,6 +116,10 @@ def unavailable(input_file, input_checks):
116
  output = "Submitting your own data is currently unavailable, but you can try out the showcase mode 😊"
117
  return gr.update(value=output, label="Oops!", visible=True)
118
 
 
 
 
 
119
  def file(input_file, input_checks):
120
  #output = "output.txt"
121
  #f = open(output, 'w')
@@ -166,7 +170,7 @@ def freq(output_file, input_checks):
166
  width=600).configure_axis(
167
  grid=False).interactive()
168
 
169
- if "emotion distribution over time" in input_checks:
170
  return gr.update(value=plot, visible=True), gr.update(visible=True), gr.update(visible=False), gr.update(visible=False) # next_button_dist becomes available
171
  elif "peaks" in input_checks:
172
  return gr.update(value=plot, visible=True), gr.update(visible=False), gr.update(visible=True), gr.update(visible=False) # next_button_peaks becomes available
@@ -397,6 +401,7 @@ with gr.Blocks() as demo:
397
  next_button_peaks.click(fn=peaks, inputs=[output_file,input_checks], outputs=[output_peaks,next_button_topics])
398
  next_button_topics.click(fn=topics, inputs=[output_file,input_checks], outputs=output_topics)
399
  #send_btn.click(fn=unavailable, inputs=[input_file,input_checks], outputs=message)
 
400
 
401
 
402
  demo.launch()
 
116
  output = "Submitting your own data is currently unavailable, but you can try out the showcase mode 😊"
117
  return gr.update(value=output, label="Oops!", visible=True)
118
 
119
+ def showcase(input_file):
120
+ output = "showcase/data.txt"
121
+ 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
122
+
123
  def file(input_file, input_checks):
124
  #output = "output.txt"
125
  #f = open(output, 'w')
 
170
  width=600).configure_axis(
171
  grid=False).interactive()
172
 
173
+ if "emotion distribution over time" in input_checks or (output_file.name).endswith('showcase/data.txt'):
174
  return gr.update(value=plot, visible=True), gr.update(visible=True), gr.update(visible=False), gr.update(visible=False) # next_button_dist becomes available
175
  elif "peaks" in input_checks:
176
  return gr.update(value=plot, visible=True), gr.update(visible=False), gr.update(visible=True), gr.update(visible=False) # next_button_peaks becomes available
 
401
  next_button_peaks.click(fn=peaks, inputs=[output_file,input_checks], outputs=[output_peaks,next_button_topics])
402
  next_button_topics.click(fn=topics, inputs=[output_file,input_checks], outputs=output_topics)
403
  #send_btn.click(fn=unavailable, inputs=[input_file,input_checks], outputs=message)
404
+ demo_btn.click(fn=showcase, inputs=[input_file], outputs=[output_file,next_button_freq,next_button_dist,next_button_peaks,next_button_topics])
405
 
406
 
407
  demo.launch()