lunadebruyne commited on
Commit
9f90723
Β·
1 Parent(s): 823fbc6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -118,11 +118,11 @@ def inference_sentence(text):
118
 
119
  def unavailable(input_file, input_checks):
120
  output = "As we are currently updating this demo, submitting your own data is unavailable for the moment. However, you can try out the showcase mode 😊"
121
- return gr.update(value=output, label="Oops!", visible=True)
122
 
123
  def showcase(input_file):
124
  output = "showcase/example_predictions.txt"
125
- return gr.update(visible=False), 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
126
 
127
  def file(input_file, input_checks):
128
  #output = "output.txt"
@@ -322,6 +322,10 @@ with gr.Blocks() as demo:
322
  """)
323
  with gr.Row():
324
  with gr.Column():
 
 
 
 
325
  message = gr.Textbox(label="Message", visible=False)
326
 
327
  output_file = gr.File(label="Predictions", visible=False)
@@ -343,8 +347,8 @@ with gr.Blocks() as demo:
343
  next_button_dist.click(fn=dist, inputs=[output_file,input_checks], outputs=[output_dist,next_button_peaks,next_button_topics])
344
  next_button_peaks.click(fn=peaks, inputs=[output_file,input_checks], outputs=[output_peaks,next_button_topics])
345
  next_button_topics.click(fn=topics, inputs=[output_file,input_checks], outputs=output_topics)
346
- send_btn.click(fn=unavailable, inputs=[input_file,input_checks], outputs=message)
347
- demo_btn.click(fn=showcase, inputs=[input_file], outputs=[message,output_file,next_button_freq,next_button_dist,next_button_peaks,next_button_topics])
348
 
349
 
350
  demo.launch()
 
118
 
119
  def unavailable(input_file, input_checks):
120
  output = "As we are currently updating this demo, submitting your own data is unavailable for the moment. However, you can try out the showcase mode 😊"
121
+ return gr.update(visible=True), gr.update(value=output, label="Oops!", visible=True)
122
 
123
  def showcase(input_file):
124
  output = "showcase/example_predictions.txt"
125
+ return gr.update(visible=True), gr.update(visible=False), 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
126
 
127
  def file(input_file, input_checks):
128
  #output = "output.txt"
 
322
  """)
323
  with gr.Row():
324
  with gr.Column():
325
+ output_markdown = gr.Markdown("""
326
+ ### Output
327
+ """, visible=False)
328
+
329
  message = gr.Textbox(label="Message", visible=False)
330
 
331
  output_file = gr.File(label="Predictions", visible=False)
 
347
  next_button_dist.click(fn=dist, inputs=[output_file,input_checks], outputs=[output_dist,next_button_peaks,next_button_topics])
348
  next_button_peaks.click(fn=peaks, inputs=[output_file,input_checks], outputs=[output_peaks,next_button_topics])
349
  next_button_topics.click(fn=topics, inputs=[output_file,input_checks], outputs=output_topics)
350
+ send_btn.click(fn=unavailable, inputs=[input_file,input_checks], [output_markdown,outputs=message)
351
+ demo_btn.click(fn=showcase, inputs=[input_file], outputs=[output_markdown,message,output_file,next_button_freq,next_button_dist,next_button_peaks,next_button_topics])
352
 
353
 
354
  demo.launch()