Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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=
|
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 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|