fffiloni radames HF staff commited on
Commit
cd07abe
1 Parent(s): 62ec771

make share button visible when ready (#5)

Browse files

- make share button visible when ready (217c495f111db04c3eecf0b56a81f87b52fdee21)


Co-authored-by: Radamés Ajna <radames@users.noreply.huggingface.co>

Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -21,7 +21,7 @@ def infer(audio):
21
  #portrait_response = requests.get(portrait_link, headers={'Authorization': 'Bearer ' + token})
22
  #print(portrait_response.text)
23
 
24
- return whisper_to_gpt_response[0], portrait_link, gr.update(visible=True), gr.update(visible=True), gr.update(visible=True)
25
 
26
  title = """
27
  <div style="text-align: center; max-width: 500px; margin: 0 auto;">
@@ -59,12 +59,12 @@ with gr.Blocks(css="style.css") as demo:
59
 
60
  send_btn = gr.Button("Send my request !")
61
 
62
- with gr.Group(elem_id="share-btn-container"):
63
- community_icon = gr.HTML(community_icon_html, visible=False)
64
- loading_icon = gr.HTML(loading_icon_html, visible=False)
65
- share_button = gr.Button("Share to community", elem_id="share-btn", visible=False)
66
 
67
- send_btn.click(infer, inputs=[record_input], outputs=[whisper_tr, gpt_response, share_button, community_icon, loading_icon])
68
  share_button.click(None, [], [], _js=share_js)
69
 
70
  demo.queue(max_size=32, concurrency_count=20).launch(debug=True)
 
21
  #portrait_response = requests.get(portrait_link, headers={'Authorization': 'Bearer ' + token})
22
  #print(portrait_response.text)
23
 
24
+ return whisper_to_gpt_response[0], portrait_link, gr.update(visible=True)
25
 
26
  title = """
27
  <div style="text-align: center; max-width: 500px; margin: 0 auto;">
 
59
 
60
  send_btn = gr.Button("Send my request !")
61
 
62
+ with gr.Group(elem_id="share-btn-container", visible=False) as share_group:
63
+ community_icon = gr.HTML(community_icon_html)
64
+ loading_icon = gr.HTML(loading_icon_html)
65
+ share_button = gr.Button("Share to community", elem_id="share-btn")
66
 
67
+ send_btn.click(infer, inputs=[record_input], outputs=[whisper_tr, gpt_response, share_group])
68
  share_button.click(None, [], [], _js=share_js)
69
 
70
  demo.queue(max_size=32, concurrency_count=20).launch(debug=True)