gorkemgoknar commited on
Commit
b405991
·
1 Parent(s): 020a820

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -48,10 +48,11 @@ def reformat_freq(sr, y):
48
  sr = 16000
49
  return sr, y
50
 
 
 
 
 
51
  def stt_record(audio_record_buffer):
52
- #using english model
53
- acoustic_model = Model(hf_hub_download(repo_id = REPO_ID, filename = "english/model.tflite"))
54
- scorer_path = hf_hub_download(repo_id = REPO_ID, filename = "english/huge-vocabulary.scorer")
55
  _, y = reformat_freq(*audio_record_buffer)
56
  scorer = True # use scorer
57
  if scorer:
@@ -190,7 +191,7 @@ def greet(character,your_voice,message,history):
190
 
191
 
192
 
193
- def greet_stt_to_tts(character,your_voice,message,history):
194
 
195
  #gradios set_state/get_state had problems on embedded html!
196
  history = history or {"character": character, "message_history" : [] }
@@ -274,8 +275,7 @@ history = {"character": "None", "message_history" : [] }
274
 
275
  interface_full = gr.Interface(fn=greet_stt_to_tts,
276
  inputs=[gr.inputs.Dropdown(personality_choices),
277
- gr.inputs.Audio(source="microphone", type="filepath") ,
278
- "text",
279
  "state"],
280
  outputs=["html","state",gr.outputs.Audio(type="file")],
281
  css=css, title="Chat with Your Voice", description=description,article=article ,
 
48
  sr = 16000
49
  return sr, y
50
 
51
+ #using english model
52
+ acoustic_model = Model(hf_hub_download(repo_id = REPO_ID, filename = "english/model.tflite"))
53
+ scorer_path = hf_hub_download(repo_id = REPO_ID, filename = "english/huge-vocabulary.scorer")
54
+
55
  def stt_record(audio_record_buffer):
 
 
 
56
  _, y = reformat_freq(*audio_record_buffer)
57
  scorer = True # use scorer
58
  if scorer:
 
191
 
192
 
193
 
194
+ def greet_stt_to_tts(character,your_voice,history):
195
 
196
  #gradios set_state/get_state had problems on embedded html!
197
  history = history or {"character": character, "message_history" : [] }
 
275
 
276
  interface_full = gr.Interface(fn=greet_stt_to_tts,
277
  inputs=[gr.inputs.Dropdown(personality_choices),
278
+ gr.inputs.Audio(source="microphone", type="numpy", label="Record Audio", streaming=True) ,
 
279
  "state"],
280
  outputs=["html","state",gr.outputs.Audio(type="file")],
281
  css=css, title="Chat with Your Voice", description=description,article=article ,