broadfield commited on
Commit
c65b118
·
verified ·
1 Parent(s): d94dde6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -39,8 +39,8 @@ def generate(prompt,history):
39
  buf = ""
40
  for response in stream:
41
  output += response.token.text
42
- yield [(prompt,output)], output
43
- #yield [(prompt,output)], output
44
 
45
  def load_mod(model):
46
  yield f"Loading: {model}"
@@ -50,7 +50,6 @@ def tts(inp,names,length,noise,width,sen_pause):
50
  print(inp)
51
  yield from pp.stream_tts(inp,names,length,noise,width,sen_pause)
52
  with gr.Blocks() as iface:
53
- stt=gr.Textbox()
54
  aud=gr.Audio(streaming=True, autoplay=True)
55
  chatbot=gr.Chatbot(show_label=False, show_share_button=False, show_copy_button=True, layout="panel")
56
  prompt = gr.Textbox()
@@ -67,7 +66,8 @@ with gr.Blocks() as iface:
67
  width=gr.Slider(label="Noise Width", minimum=0.01, maximum=3.0, value=0.5)
68
  sen_pause=gr.Slider(label="Sentence Pause", minimum=0.1, maximum=10.0, value=1)
69
  upd_btn=gr.Button("Update")
70
-
 
71
  iface.load(load_mod,names,msg)
72
  sub_b = submit_b.click(generate, [prompt,chatbot],[chatbot,stt]).then(tts,[stt,names,length,noise,width,sen_pause],aud)
73
  #ub_e = prompt.submit(generate, [prompt, chatbot], [chatbot,stt])
 
39
  buf = ""
40
  for response in stream:
41
  output += response.token.text
42
+ yield [(prompt,output)], ""
43
+ yield [(prompt,output)], output
44
 
45
  def load_mod(model):
46
  yield f"Loading: {model}"
 
50
  print(inp)
51
  yield from pp.stream_tts(inp,names,length,noise,width,sen_pause)
52
  with gr.Blocks() as iface:
 
53
  aud=gr.Audio(streaming=True, autoplay=True)
54
  chatbot=gr.Chatbot(show_label=False, show_share_button=False, show_copy_button=True, layout="panel")
55
  prompt = gr.Textbox()
 
66
  width=gr.Slider(label="Noise Width", minimum=0.01, maximum=3.0, value=0.5)
67
  sen_pause=gr.Slider(label="Sentence Pause", minimum=0.1, maximum=10.0, value=1)
68
  upd_btn=gr.Button("Update")
69
+ with gr.Row(visible=False):
70
+ stt=gr.Textbox()
71
  iface.load(load_mod,names,msg)
72
  sub_b = submit_b.click(generate, [prompt,chatbot],[chatbot,stt]).then(tts,[stt,names,length,noise,width,sen_pause],aud)
73
  #ub_e = prompt.submit(generate, [prompt, chatbot], [chatbot,stt])