NeoPy commited on
Commit
57a155d
·
verified ·
1 Parent(s): d600ff8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -70,9 +70,9 @@ def load_f5tts(
70
  F5TTS_ema_model = load_f5tts()
71
 
72
 
73
-
74
- client = Groq(api_key=os.getenv("Groq_TOKEN"))
75
-
76
 
77
  @gpu_decorator
78
  def generate_response(messages):
@@ -196,6 +196,7 @@ Have a conversation with an AI using your reference voice!
196
 
197
  with chat_interface_container:
198
  with gr.Row():
 
199
  with gr.Column():
200
  ref_audio_chat = gr.Audio(label="Reference Audio", type="filepath")
201
  with gr.Column():
@@ -221,6 +222,9 @@ Have a conversation with an AI using your reference voice!
221
  audio_input_chat = gr.Microphone(label="Speak your message", type="filepath")
222
  audio_output_chat = gr.Audio(autoplay=True)
223
  with gr.Column():
 
 
 
224
  text_input_chat = gr.Textbox(label="Type your message", lines=1)
225
  send_btn_chat = gr.Button("Send Message")
226
  clear_btn_chat = gr.Button("Clear Conversation")
@@ -294,6 +298,7 @@ Have a conversation with an AI using your reference voice!
294
  outputs=[audio_output_chat, ref_text_chat],
295
  ).then(lambda: None, None, audio_input_chat)
296
 
 
297
  text_input_chat.submit(
298
  process_audio_input,
299
  inputs=[audio_input_chat, text_input_chat, chatbot_interface, conversation_state],
 
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):
 
196
 
197
  with chat_interface_container:
198
  with gr.Row():
199
+
200
  with gr.Column():
201
  ref_audio_chat = gr.Audio(label="Reference Audio", type="filepath")
202
  with gr.Column():
 
222
  audio_input_chat = gr.Microphone(label="Speak your message", type="filepath")
223
  audio_output_chat = gr.Audio(autoplay=True)
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
  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],