Spaces:
Build error
Build error
Commit
•
392fb0c
1
Parent(s):
0735709
Update app.py
Browse files
app.py
CHANGED
@@ -126,7 +126,7 @@ def tts(text: str, speaker_idx: str=None):
|
|
126 |
return fp.name
|
127 |
|
128 |
|
129 |
-
def greet(character,message,history):
|
130 |
|
131 |
#gradios set_state/get_state had problems on embedded html!
|
132 |
history = history or {"character": character, "message_history" : [] }
|
@@ -139,7 +139,7 @@ def greet(character,message,history):
|
|
139 |
|
140 |
|
141 |
response = get_chat_response(character,history=history["message_history"],input_txt=message)
|
142 |
-
tts(response)
|
143 |
|
144 |
history["message_history"].append((message, response))
|
145 |
|
@@ -150,7 +150,7 @@ def greet(character,message,history):
|
|
150 |
html += f"<div class='resp_msg'>{character}: {resp_msg}</div>"
|
151 |
html += "</div>"
|
152 |
|
153 |
-
return html,history
|
154 |
|
155 |
|
156 |
|
@@ -176,7 +176,11 @@ article = "<p style='text-align: center'><a href='https://www.linkedin.com/pulse
|
|
176 |
##interface = gr.Interface(fn=greet, inputs=[gr.inputs.Dropdown(personality_choices) ,"text"], title=title, description=description, outputs="text")
|
177 |
|
178 |
history = {"character": "None", "message_history" : [] }
|
179 |
-
interface= gr.Interface(fn=greet,
|
|
|
|
|
|
|
|
|
180 |
|
181 |
|
182 |
if __name__ == "__main__":
|
|
|
126 |
return fp.name
|
127 |
|
128 |
|
129 |
+
def greet(character,message,history,voice):
|
130 |
|
131 |
#gradios set_state/get_state had problems on embedded html!
|
132 |
history = history or {"character": character, "message_history" : [] }
|
|
|
139 |
|
140 |
|
141 |
response = get_chat_response(character,history=history["message_history"],input_txt=message)
|
142 |
+
voice = tts(response)
|
143 |
|
144 |
history["message_history"].append((message, response))
|
145 |
|
|
|
150 |
html += f"<div class='resp_msg'>{character}: {resp_msg}</div>"
|
151 |
html += "</div>"
|
152 |
|
153 |
+
return html,history,voice
|
154 |
|
155 |
|
156 |
|
|
|
176 |
##interface = gr.Interface(fn=greet, inputs=[gr.inputs.Dropdown(personality_choices) ,"text"], title=title, description=description, outputs="text")
|
177 |
|
178 |
history = {"character": "None", "message_history" : [] }
|
179 |
+
interface= gr.Interface(fn=greet,
|
180 |
+
inputs=[gr.inputs.Dropdown(personality_choices) ,"text", "state"],
|
181 |
+
outputs=["html","state", gr.outputs.Audio(label="voice"),],
|
182 |
+
|
183 |
+
css=css, title=title, description=description,article=article )
|
184 |
|
185 |
|
186 |
if __name__ == "__main__":
|