Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -152,25 +152,6 @@ async def main():
|
|
152 |
|
153 |
# Create a Gradio interface
|
154 |
with gr.Blocks(title='Chatbot Demo') as demo:
|
155 |
-
gr.Markdown(
|
156 |
-
"""
|
157 |
-
<div style="text-align: center;">
|
158 |
-
<h1 style="font-weight: bold; font-size: 30px;">Insurance Voicebot Demo</h1>
|
159 |
-
</div>
|
160 |
-
<div style="text-align: left;">
|
161 |
-
<p style="font-weight: bold; font-size: 20px;"><strong>To try this demo follow these steps.</strong></p>
|
162 |
-
</div>
|
163 |
-
"""
|
164 |
-
)
|
165 |
-
gr.Markdown("""
|
166 |
-
- From **Audio** block, click **Record** button and speak something to the bot.
|
167 |
-
- When finished recording, click **Stop** button.
|
168 |
-
- Click **Submit Voice✔️** button.
|
169 |
-
- Wait until bot generate text and audio response.
|
170 |
-
- From **Generated audio response** block, click play button to play bot's audio response.
|
171 |
-
- Continue these steps until you want to restart.
|
172 |
-
"""
|
173 |
-
)
|
174 |
|
175 |
chatbot = gr.Chatbot(
|
176 |
[[None, Bot_dialog.nodes["START A"]["response"]]],
|
@@ -203,6 +184,25 @@ async def main():
|
|
203 |
)
|
204 |
|
205 |
restart_btn = gr.Button(value='Restart🔄')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
|
207 |
voice_btn.stop_recording(addfile, inputs=voice_btn, outputs=txt)
|
208 |
voicesubmit_btn.click(submit_file, inputs=voice_btn, outputs=txt).then(speech_to_text, inputs=voice_btn, outputs=txt).then(user, [txt, chatbot], [txt, chatbot], queue=False).then(bot, chatbot, chatbot).then(clear_audio, outputs=voice_btn).then(text_to_speech, inputs=chatbot, outputs=audio)
|
|
|
152 |
|
153 |
# Create a Gradio interface
|
154 |
with gr.Blocks(title='Chatbot Demo') as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
|
156 |
chatbot = gr.Chatbot(
|
157 |
[[None, Bot_dialog.nodes["START A"]["response"]]],
|
|
|
184 |
)
|
185 |
|
186 |
restart_btn = gr.Button(value='Restart🔄')
|
187 |
+
gr.Markdown(
|
188 |
+
"""
|
189 |
+
<div style="text-align: center;">
|
190 |
+
<h1 style="font-weight: bold; font-size: 30px;">Insurance Voicebot Demo</h1>
|
191 |
+
</div>
|
192 |
+
<div style="text-align: left;">
|
193 |
+
<p style="font-weight: bold; font-size: 20px;"><strong>To try this demo follow these steps.</strong></p>
|
194 |
+
</div>
|
195 |
+
"""
|
196 |
+
)
|
197 |
+
gr.Markdown("""
|
198 |
+
- From **Audio** block, click **Record** button and speak something to the bot.
|
199 |
+
- When finished recording, click **Stop** button.
|
200 |
+
- Click **Submit Voice✔️** button.
|
201 |
+
- Wait until bot generate text and audio response.
|
202 |
+
- From **Generated audio response** block, click play button to play bot's audio response.
|
203 |
+
- Continue these steps until you want to restart.
|
204 |
+
"""
|
205 |
+
)
|
206 |
|
207 |
voice_btn.stop_recording(addfile, inputs=voice_btn, outputs=txt)
|
208 |
voicesubmit_btn.click(submit_file, inputs=voice_btn, outputs=txt).then(speech_to_text, inputs=voice_btn, outputs=txt).then(user, [txt, chatbot], [txt, chatbot], queue=False).then(bot, chatbot, chatbot).then(clear_audio, outputs=voice_btn).then(text_to_speech, inputs=chatbot, outputs=audio)
|