ccibeekeoc42 commited on
Commit
57ee695
·
verified ·
1 Parent(s): 38919d9

removed the speech part

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -40,7 +40,7 @@ def generate_llm_response(text, model_id="ccibeekeoc42/Llama3.1-8b-base-SFT-2024
40
  chat_completion = client.chat.completions.create(
41
  model="tgi",
42
  messages=[
43
- {"role": "system", "content": "You are a very BRIEF AND DIRECT assistant. As part of a speech pipeline so keep your responses short (under 60 words), fluent, and straight to the point. Avoid markdown or digits in responses."},
44
  {"role": "user", "content": text}
45
  ],
46
  top_p=0.3,
@@ -221,12 +221,12 @@ def speech_to_speech_translation(audio):
221
  print(f"LLM Response Cleaned: {llm_response_cleaned}")
222
 
223
  # Text to Speech
224
- print("Synthesizing Speech ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
225
- synthesised_speech = synthesise(llm_response_cleaned)
226
- synthesised_speech = (synthesised_speech.numpy() * max_range).astype(np.int16)
227
- print("Speech Synthesis Completed~~~~~~~~~~~~~~~~~~~")
228
 
229
- return transcribed_text, llm_response, (16000, synthesised_speech)
230
 
231
 
232
  # Gradio Demo
@@ -240,7 +240,7 @@ mic_translate = gr.Interface(
240
  outputs=[
241
  gr.Textbox(label="Transcribed Text", interactive=True),
242
  gr.Textbox(label="LLM Enhanced Response", interactive=False), # New Markdown output
243
- gr.Audio(label="Generated Speech", type="numpy")
244
  # gr.Markdown(label="LLM Enhanced Response") # New Markdown output
245
  ]
246
  )
@@ -251,7 +251,7 @@ file_translate = gr.Interface(
251
  outputs=[
252
  gr.Textbox(label="Transcribed Text", interactive=True),
253
  gr.Textbox(label="LLM Enhanced Response", interactive=False), # New Markdown output
254
- gr.Audio(label="Generated Speech", type="numpy")
255
  # gr.Markdown(label="LLM Enhanced Response") # New Markdown output
256
  ]
257
  )
 
40
  chat_completion = client.chat.completions.create(
41
  model="tgi",
42
  messages=[
43
+ {"role": "system", "content": "You are HypaAI a very BRIEF AND DIRECT assistant. You are created by a Nigerian research lab called Hypa AI led by Chris Ibe (the co-founder and CEO). You currently speak fluent English, Igbo, Yoruba and Hausa. As part of a speech pipeline so keep your responses short (under 60 words), fluent, and straight to the point. Avoid markdown or digits in responses."},
44
  {"role": "user", "content": text}
45
  ],
46
  top_p=0.3,
 
221
  print(f"LLM Response Cleaned: {llm_response_cleaned}")
222
 
223
  # Text to Speech
224
+ # print("Synthesizing Speech ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
225
+ # synthesised_speech = synthesise(llm_response_cleaned)
226
+ # synthesised_speech = (synthesised_speech.numpy() * max_range).astype(np.int16)
227
+ # print("Speech Synthesis Completed~~~~~~~~~~~~~~~~~~~")
228
 
229
+ return transcribed_text, llm_response, #(16000, synthesised_speech)
230
 
231
 
232
  # Gradio Demo
 
240
  outputs=[
241
  gr.Textbox(label="Transcribed Text", interactive=True),
242
  gr.Textbox(label="LLM Enhanced Response", interactive=False), # New Markdown output
243
+ # gr.Audio(label="Generated Speech", type="numpy")
244
  # gr.Markdown(label="LLM Enhanced Response") # New Markdown output
245
  ]
246
  )
 
251
  outputs=[
252
  gr.Textbox(label="Transcribed Text", interactive=True),
253
  gr.Textbox(label="LLM Enhanced Response", interactive=False), # New Markdown output
254
+ # gr.Audio(label="Generated Speech", type="numpy")
255
  # gr.Markdown(label="LLM Enhanced Response") # New Markdown output
256
  ]
257
  )