Update app.py
Browse files
app.py
CHANGED
@@ -144,21 +144,41 @@ def handle_query(audio_or_text: str):
|
|
144 |
return response
|
145 |
|
146 |
with gr.Blocks() as demo:
|
147 |
-
|
148 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
out_text = gr.Textbox(label="Answer (text)")
|
150 |
out_audio = gr.Audio(label="Answer (speech)")
|
151 |
submit = gr.Button("Submit")
|
152 |
-
gr.Examples(
|
153 |
-
examples=[
|
154 |
-
["What is the max revenue product today?"],
|
155 |
-
["Who invented the light bulb?"],
|
156 |
-
["Tell me a joke about cats."],
|
157 |
-
],
|
158 |
-
inputs=inp,
|
159 |
-
outputs=[out_text, out_audio],
|
160 |
-
)
|
161 |
submit.click(fn=handle_query, inputs=inp, outputs=[out_text, out_audio])
|
162 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
if __name__ == "__main__":
|
164 |
demo.launch(share=False, server_name="0.0.0.0", server_port=7860)
|
|
|
144 |
return response
|
145 |
|
146 |
with gr.Blocks() as demo:
|
147 |
+
|
148 |
+
gr.Markdown(
|
149 |
+
"""
|
150 |
+
**Shop Voice-Box Assistant Demo!**
|
151 |
+
|
152 |
+
**Usage Instructions:**
|
153 |
+
- Speak into your microphone or upload transactions.csv for data queries.
|
154 |
+
- Sample questions you can ask:
|
155 |
+
- What is the max revenue product today?
|
156 |
+
- Who invented the light bulb?
|
157 |
+
- Tell me a joke about cats.
|
158 |
+
"""
|
159 |
+
)
|
160 |
+
inp = gr.Audio(sources=["microphone"], type="filepath", label="Speak or type your question")
|
161 |
out_text = gr.Textbox(label="Answer (text)")
|
162 |
out_audio = gr.Audio(label="Answer (speech)")
|
163 |
submit = gr.Button("Submit")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
submit.click(fn=handle_query, inputs=inp, outputs=[out_text, out_audio])
|
165 |
|
166 |
+
# with gr.Blocks() as demo:
|
167 |
+
# gr.Markdown("## Shop Voice-Box Assistant (Speech In/Out)")
|
168 |
+
# inp = gr.Audio(sources=["microphone"], type="filepath", label="Speak or type your question or upload transactions.csv separately in root")
|
169 |
+
# out_text = gr.Textbox(label="Answer (text)")
|
170 |
+
# out_audio = gr.Audio(label="Answer (speech)")
|
171 |
+
# submit = gr.Button("Submit")
|
172 |
+
# gr.Examples(
|
173 |
+
# examples=[
|
174 |
+
# ["What is the max revenue product today?"],
|
175 |
+
# ["Who invented the light bulb?"],
|
176 |
+
# ["Tell me a joke about cats."],
|
177 |
+
# ],
|
178 |
+
# inputs=inp,
|
179 |
+
# outputs=[out_text, out_audio],
|
180 |
+
# )
|
181 |
+
# submit.click(fn=handle_query, inputs=inp, outputs=[out_text, out_audio])
|
182 |
+
|
183 |
if __name__ == "__main__":
|
184 |
demo.launch(share=False, server_name="0.0.0.0", server_port=7860)
|