Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -32,8 +32,8 @@ def process_text_input(api_key, text_prompt, selected_voice):
|
|
32 |
with open(temp_path, "wb") as f:
|
33 |
f.write(wav_bytes)
|
34 |
|
35 |
-
# Get the text response
|
36 |
-
text_response = completion.choices[0].message.content
|
37 |
|
38 |
return text_response, temp_path
|
39 |
except Exception as e:
|
@@ -89,8 +89,8 @@ def process_audio_input(api_key, audio_path, text_prompt, selected_voice):
|
|
89 |
with open(temp_path, "wb") as f:
|
90 |
f.write(wav_bytes)
|
91 |
|
92 |
-
# Get the text response
|
93 |
-
text_response = completion.choices[0].message.content
|
94 |
|
95 |
return text_response, temp_path
|
96 |
except Exception as e:
|
@@ -118,9 +118,9 @@ def use_example_audio():
|
|
118 |
return audio_path
|
119 |
|
120 |
# Create Gradio Interface
|
121 |
-
with gr.Blocks(title="
|
122 |
-
gr.Markdown("#
|
123 |
-
gr.Markdown("
|
124 |
|
125 |
# API Key input (used across all tabs)
|
126 |
api_key = gr.Textbox(
|
@@ -219,7 +219,10 @@ with gr.Blocks(title="OpenAI Audio Chat App") as app:
|
|
219 |
with open(temp_path, "wb") as f:
|
220 |
f.write(wav_bytes)
|
221 |
|
222 |
-
|
|
|
|
|
|
|
223 |
except Exception as e:
|
224 |
return f"Error: {str(e)}", None
|
225 |
|
|
|
32 |
with open(temp_path, "wb") as f:
|
33 |
f.write(wav_bytes)
|
34 |
|
35 |
+
# Get the text response - fix to retrieve text content properly
|
36 |
+
text_response = completion.choices[0].message.content[0].text
|
37 |
|
38 |
return text_response, temp_path
|
39 |
except Exception as e:
|
|
|
89 |
with open(temp_path, "wb") as f:
|
90 |
f.write(wav_bytes)
|
91 |
|
92 |
+
# Get the text response - fix to retrieve text content properly
|
93 |
+
text_response = completion.choices[0].message.content[0].text
|
94 |
|
95 |
return text_response, temp_path
|
96 |
except Exception as e:
|
|
|
118 |
return audio_path
|
119 |
|
120 |
# Create Gradio Interface
|
121 |
+
with gr.Blocks(title="VoxTalk") as app:
|
122 |
+
gr.Markdown("# VoxTalk")
|
123 |
+
gr.Markdown("*Voice-to-voice AI interaction platform*")
|
124 |
|
125 |
# API Key input (used across all tabs)
|
126 |
api_key = gr.Textbox(
|
|
|
219 |
with open(temp_path, "wb") as f:
|
220 |
f.write(wav_bytes)
|
221 |
|
222 |
+
# Fix to retrieve text content properly
|
223 |
+
text_response = completion.choices[0].message.content[0].text
|
224 |
+
|
225 |
+
return f"Sample: {text_response}", temp_path
|
226 |
except Exception as e:
|
227 |
return f"Error: {str(e)}", None
|
228 |
|