abidlabs HF staff commited on
Commit
9af9919
1 Parent(s): f1d0dae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -77,18 +77,19 @@ with demo:
77
  check = gr.Radio(["Speaker 0", "Speaker 1"], label='Choose speaker for sentiment analysis')
78
  analyzed = gr.HighlightedText(label="Customer Sentiment")
79
 
80
- btn.click(speech_to_text, audio, [diarized, full], status_tracker=gr.StatusTracker(cover_container=True))
81
- check.change(sentiment, [check, diarized], analyzed, status_tracker=gr.StatusTracker(cover_container=True))
82
 
83
  def cache_example(example):
84
  processed_examples = audio.preprocess_example(example)
85
- return processed_examples
 
86
 
87
  cache = [cache_example(e) for e in EXAMPLES]
88
 
89
  def load_example(example_id):
90
  return cache[example_id]
91
 
92
- examples._click_no_postprocess(load_example, inputs=[examples], outputs=[audio])
93
 
94
  demo.launch()
 
77
  check = gr.Radio(["Speaker 0", "Speaker 1"], label='Choose speaker for sentiment analysis')
78
  analyzed = gr.HighlightedText(label="Customer Sentiment")
79
 
80
+ btn.click(speech_to_text, audio, [diarized, full])
81
+ check.change(sentiment, [check, diarized], analyzed)
82
 
83
  def cache_example(example):
84
  processed_examples = audio.preprocess_example(example)
85
+ diarized_output, full_text = speech_to_text(processed_examples )
86
+ return processed_examples, diarized_output, full_text
87
 
88
  cache = [cache_example(e) for e in EXAMPLES]
89
 
90
  def load_example(example_id):
91
  return cache[example_id]
92
 
93
+ examples._click_no_postprocess(load_example, inputs=[examples], outputs=[audio, diarized, full], queue=False)
94
 
95
  demo.launch()