Update app.py
Browse files
app.py
CHANGED
@@ -81,6 +81,9 @@ def call_api(message, openai_api_key):
|
|
81 |
|
82 |
return str(response.choices[0].text).split("\n",2)[2]
|
83 |
|
|
|
|
|
|
|
84 |
title = """
|
85 |
<div style="text-align: center; max-width: 500px; margin: 0 auto;">
|
86 |
<div
|
@@ -122,10 +125,11 @@ with gr.Blocks(css="style.css") as demo:
|
|
122 |
with gr.Row():
|
123 |
record_input = gr.Audio(source="microphone",type="filepath", label="Audio input", show_label=True, elem_id="record_btn")
|
124 |
openai_api_key = gr.Textbox(max_lines=1, type="password", label="Your OpenAI API Key", placeholder="sk-123abc...")
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
|
|
129 |
send_btn.click(infer, inputs=[record_input, openai_api_key], outputs=[whisper_tr, gpt_response, error_handler, share_group])
|
130 |
share_button.click(None, [], [], _js=share_js)
|
131 |
|
|
|
81 |
|
82 |
return str(response.choices[0].text).split("\n",2)[2]
|
83 |
|
84 |
+
def clean_components():
|
85 |
+
return gr.HTML.update(visible=False), gr.Textbox(visible=False)
|
86 |
+
|
87 |
title = """
|
88 |
<div style="text-align: center; max-width: 500px; margin: 0 auto;">
|
89 |
<div
|
|
|
125 |
with gr.Row():
|
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_compoments, inputs=[], outputs=[error_handler, whisper_tr])
|
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 |
|