Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -34,7 +34,7 @@ def record_text(audio_file):
|
|
34 |
|
35 |
|
36 |
def api_calling(audio_file, prompt, api_key):
|
37 |
-
audio_text = record_text(audio_file)
|
38 |
if len(prompt) == 0:
|
39 |
prompt = "Apply proper punctuations, upper case and lower case to the provided text."
|
40 |
|
@@ -54,7 +54,7 @@ def api_calling(audio_file, prompt, api_key):
|
|
54 |
},
|
55 |
{
|
56 |
"type": "text",
|
57 |
-
"text":
|
58 |
}
|
59 |
]
|
60 |
}
|
@@ -86,6 +86,7 @@ with block:
|
|
86 |
with gr.Row():
|
87 |
with gr.Column(scale=0.5):
|
88 |
aud_input = gr.Audio(type="filepath", label="Upload Audio")
|
|
|
89 |
api_input = gr.Textbox(label="Enter Api-key")
|
90 |
upload_button = gr.Button(value="Upload & Start Chat", interactive=True, variant="primary")
|
91 |
with gr.Column():
|
@@ -93,7 +94,7 @@ with block:
|
|
93 |
message = gr.Textbox(label="User", placeholder=prompt)
|
94 |
state = gr.State()
|
95 |
|
96 |
-
upload_button.click(message_and_history, inputs=[
|
97 |
-
message.submit(message_and_history, inputs=[
|
98 |
message.submit(lambda: None, None, message, queue=False)
|
99 |
block.launch(share=True)
|
|
|
34 |
|
35 |
|
36 |
def api_calling(audio_file, prompt, api_key):
|
37 |
+
# audio_text = record_text(audio_file)
|
38 |
if len(prompt) == 0:
|
39 |
prompt = "Apply proper punctuations, upper case and lower case to the provided text."
|
40 |
|
|
|
54 |
},
|
55 |
{
|
56 |
"type": "text",
|
57 |
+
"text": audio_file
|
58 |
}
|
59 |
]
|
60 |
}
|
|
|
86 |
with gr.Row():
|
87 |
with gr.Column(scale=0.5):
|
88 |
aud_input = gr.Audio(type="filepath", label="Upload Audio")
|
89 |
+
audio_text = record_text(aud_input)
|
90 |
api_input = gr.Textbox(label="Enter Api-key")
|
91 |
upload_button = gr.Button(value="Upload & Start Chat", interactive=True, variant="primary")
|
92 |
with gr.Column():
|
|
|
94 |
message = gr.Textbox(label="User", placeholder=prompt)
|
95 |
state = gr.State()
|
96 |
|
97 |
+
upload_button.click(message_and_history, inputs=[audio_text,message, state, api_input], outputs=[chatbot, state])
|
98 |
+
message.submit(message_and_history, inputs=[audio_text,message, state, api_input], outputs=[chatbot, state])
|
99 |
message.submit(lambda: None, None, message, queue=False)
|
100 |
block.launch(share=True)
|