gdnartea commited on
Commit
2409215
·
verified ·
1 Parent(s): 43d116b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -8
app.py CHANGED
@@ -116,7 +116,7 @@ def generate_response(user_input):
116
  with torch.no_grad():
117
  outputs = proc_model.generate(
118
  inputs,
119
- max_new_tokens=256,
120
  )
121
 
122
  response = proc_tokenizer.batch_decode(
@@ -129,14 +129,14 @@ def generate_response(user_input):
129
 
130
  def CanaryPhiVits(user_voice):
131
  user_input = transcribe(user_voice)
132
- print(user_input)
 
133
  response = generate_response(user_input)
134
- print(response)
135
  if response.startswith(user_input):
136
  response = response.replace(user_input, '', 1)
 
137
  print(response)
138
  chatty_response = text_to_speech(response)
139
-
140
 
141
  return chatty_response
142
 
@@ -144,10 +144,19 @@ def CanaryPhiVits(user_voice):
144
  # Create a Gradio interface
145
  iface = gr.Interface(
146
  fn=CanaryPhiVits,
147
- inputs=gr.Audio(sources=["microphone", "upload"], type="filepath", format="wav",),
148
- #inputs=gr.Textbox(lines=5, placeholder="Enter your text here..."),
149
- #outputs=gr.Textbox(),
150
- outputs=gr.Audio("response.wav"),
 
 
 
 
 
 
 
 
 
151
  )
152
 
153
  # Launch the interface
 
116
  with torch.no_grad():
117
  outputs = proc_model.generate(
118
  inputs,
119
+ max_new_tokens=100,
120
  )
121
 
122
  response = proc_tokenizer.batch_decode(
 
129
 
130
  def CanaryPhiVits(user_voice):
131
  user_input = transcribe(user_voice)
132
+ print("user_input:")
133
+ print(user_input)
134
  response = generate_response(user_input)
 
135
  if response.startswith(user_input):
136
  response = response.replace(user_input, '', 1)
137
+ print("chatty_response:")
138
  print(response)
139
  chatty_response = text_to_speech(response)
 
140
 
141
  return chatty_response
142
 
 
144
  # Create a Gradio interface
145
  iface = gr.Interface(
146
  fn=CanaryPhiVits,
147
+ title="Chatty Ashe",
148
+ theme="gstaff/xkcd",
149
+
150
+ inputs=gr.Audio(
151
+ sources=["microphone", "upload"],
152
+ label="Input Audio",
153
+ type="filepath",
154
+ format="wav",
155
+ ),
156
+ outputs=gr.Audio(
157
+ "response.wav",
158
+ label="Output Audio"
159
+ ),
160
  )
161
 
162
  # Launch the interface