Update app.py
Browse files
app.py
CHANGED
@@ -27,7 +27,7 @@ def infer(audio, openai_api_key):
|
|
27 |
|
28 |
portrait_link = talking_face("wise_woman_portrait.png", audio_response, fn_index=0)
|
29 |
|
30 |
-
return gr.Textbox.update(value=whisper_result, visible=True), portrait_link, gr.Textbox.update(value=gpt_response[1], visible=True), gr.update(visible=True)
|
31 |
|
32 |
def try_api(message, openai_api_key):
|
33 |
|
@@ -82,7 +82,7 @@ def call_api(message, openai_api_key):
|
|
82 |
return str(response.choices[0].text).split("\n",2)[2]
|
83 |
|
84 |
def clean_components():
|
85 |
-
return gr.Audio.update(), gr.HTML.update(visible=False), gr.Textbox.update(visible=False), gr.Button(visible=False)
|
86 |
|
87 |
title = """
|
88 |
<div style="text-align: center; max-width: 500px; margin: 0 auto;">
|
@@ -126,11 +126,11 @@ with gr.Blocks(css="style.css") as demo:
|
|
126 |
record_input = gr.Audio(source="microphone",type="filepath", label="Audio input", show_label=True, elem_id="record_btn")
|
127 |
openai_api_key = gr.Textbox(max_lines=1, type="password", label="Your OpenAI API Key", placeholder="sk-123abc...")
|
128 |
with gr.Row():
|
129 |
-
clean_btn = gr.Button("Clean")
|
130 |
send_btn = gr.Button("Send my request !")
|
131 |
|
132 |
clean_btn.click(clean_components, inputs=[], outputs=[record_input, error_handler, whisper_tr, clean_btn])
|
133 |
-
send_btn.click(infer, inputs=[record_input, openai_api_key], outputs=[whisper_tr, gpt_response, error_handler, share_group])
|
134 |
share_button.click(None, [], [], _js=share_js)
|
135 |
|
136 |
demo.queue(max_size=32, concurrency_count=20).launch(debug=True)
|
|
|
27 |
|
28 |
portrait_link = talking_face("wise_woman_portrait.png", audio_response, fn_index=0)
|
29 |
|
30 |
+
return gr.Textbox.update(value=whisper_result, visible=True), portrait_link, gr.Textbox.update(value=gpt_response[1], visible=True), gr.update(visible=True), gr.Button.update(visible=True)
|
31 |
|
32 |
def try_api(message, openai_api_key):
|
33 |
|
|
|
82 |
return str(response.choices[0].text).split("\n",2)[2]
|
83 |
|
84 |
def clean_components():
|
85 |
+
return gr.Audio.update(source="microphone",type="filepath", label="Audio input", show_label=True, elem_id="record_btn"), gr.HTML.update(visible=False), gr.Textbox.update(visible=False), gr.Button.update(visible=False)
|
86 |
|
87 |
title = """
|
88 |
<div style="text-align: center; max-width: 500px; margin: 0 auto;">
|
|
|
126 |
record_input = gr.Audio(source="microphone",type="filepath", label="Audio input", show_label=True, elem_id="record_btn")
|
127 |
openai_api_key = gr.Textbox(max_lines=1, type="password", label="Your OpenAI API Key", placeholder="sk-123abc...")
|
128 |
with gr.Row():
|
129 |
+
clean_btn = gr.Button(value="Clean", visible=False)
|
130 |
send_btn = gr.Button("Send my request !")
|
131 |
|
132 |
clean_btn.click(clean_components, inputs=[], outputs=[record_input, error_handler, whisper_tr, clean_btn])
|
133 |
+
send_btn.click(infer, inputs=[record_input, openai_api_key], outputs=[whisper_tr, gpt_response, error_handler, share_group, clean_btn])
|
134 |
share_button.click(None, [], [], _js=share_js)
|
135 |
|
136 |
demo.queue(max_size=32, concurrency_count=20).launch(debug=True)
|