Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -70,12 +70,9 @@ def load_f5tts(
|
|
70 |
F5TTS_ema_model = load_f5tts()
|
71 |
|
72 |
|
73 |
-
def load_groq(apikey):
|
74 |
-
client = Groq(api_key=apikey)
|
75 |
-
return client = Groq(api_key=apikey)
|
76 |
|
77 |
@gpu_decorator
|
78 |
-
def generate_response(messages):
|
79 |
"""
|
80 |
Generate a chat response using the Groq API.
|
81 |
If messages is a string, wrap it as a user message.
|
@@ -85,6 +82,7 @@ def generate_response(messages):
|
|
85 |
else:
|
86 |
messages_payload = messages
|
87 |
|
|
|
88 |
chat_completion = client.chat.completions.create(
|
89 |
messages=messages_payload,
|
90 |
model="deepseek-r1-distill-llama-70b",
|
@@ -224,7 +222,6 @@ Have a conversation with an AI using your reference voice!
|
|
224 |
with gr.Column():
|
225 |
with gr.Row():
|
226 |
groq_apikey = gr.Textbox(label="Your Groq API Key")
|
227 |
-
load_api = gr.Button("Load API")
|
228 |
text_input_chat = gr.Textbox(label="Type your message", lines=1)
|
229 |
send_btn_chat = gr.Button("Send Message")
|
230 |
clear_btn_chat = gr.Button("Clear Conversation")
|
@@ -298,10 +295,9 @@ Have a conversation with an AI using your reference voice!
|
|
298 |
outputs=[audio_output_chat, ref_text_chat],
|
299 |
).then(lambda: None, None, audio_input_chat)
|
300 |
|
301 |
-
load_api.click(load_groq, inputs=groq_apikey, outputs=None)
|
302 |
text_input_chat.submit(
|
303 |
process_audio_input,
|
304 |
-
inputs=[audio_input_chat, text_input_chat, chatbot_interface, conversation_state],
|
305 |
outputs=[chatbot_interface, conversation_state],
|
306 |
).then(
|
307 |
generate_audio_response,
|
|
|
70 |
F5TTS_ema_model = load_f5tts()
|
71 |
|
72 |
|
|
|
|
|
|
|
73 |
|
74 |
@gpu_decorator
|
75 |
+
def generate_response(messages, apikey):
|
76 |
"""
|
77 |
Generate a chat response using the Groq API.
|
78 |
If messages is a string, wrap it as a user message.
|
|
|
82 |
else:
|
83 |
messages_payload = messages
|
84 |
|
85 |
+
client = Groq(api_key=apikey)
|
86 |
chat_completion = client.chat.completions.create(
|
87 |
messages=messages_payload,
|
88 |
model="deepseek-r1-distill-llama-70b",
|
|
|
222 |
with gr.Column():
|
223 |
with gr.Row():
|
224 |
groq_apikey = gr.Textbox(label="Your Groq API Key")
|
|
|
225 |
text_input_chat = gr.Textbox(label="Type your message", lines=1)
|
226 |
send_btn_chat = gr.Button("Send Message")
|
227 |
clear_btn_chat = gr.Button("Clear Conversation")
|
|
|
295 |
outputs=[audio_output_chat, ref_text_chat],
|
296 |
).then(lambda: None, None, audio_input_chat)
|
297 |
|
|
|
298 |
text_input_chat.submit(
|
299 |
process_audio_input,
|
300 |
+
inputs=[audio_input_chat, text_input_chat, groq_apikey, chatbot_interface, conversation_state],
|
301 |
outputs=[chatbot_interface, conversation_state],
|
302 |
).then(
|
303 |
generate_audio_response,
|