Spaces:
Runtime error
Runtime error
Commit ·
4516d66
1
Parent(s): ed151e4
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,37 +21,57 @@ def bot(history):
|
|
| 21 |
time.sleep(0.05)
|
| 22 |
yield history
|
| 23 |
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
demo.queue()
|
| 57 |
demo.launch()
|
|
|
|
| 21 |
time.sleep(0.05)
|
| 22 |
yield history
|
| 23 |
|
| 24 |
+
css = """
|
| 25 |
+
.gradio-container {
|
| 26 |
+
font-family: 'IBM Plex Sans', sans-serif;
|
| 27 |
+
}
|
| 28 |
+
.gr-button {
|
| 29 |
+
color: white;
|
| 30 |
+
border-color: black;
|
| 31 |
+
background: black;
|
| 32 |
+
}
|
| 33 |
+
.container {
|
| 34 |
+
max-width: 730px;
|
| 35 |
+
margin: auto;
|
| 36 |
+
padding-top: 1.5rem;
|
| 37 |
+
}
|
| 38 |
+
"""
|
| 39 |
+
|
| 40 |
+
with gr.Blocks(css=css) as demo:
|
| 41 |
+
|
| 42 |
+
with gr.Box():
|
| 43 |
+
|
| 44 |
+
# chatbot = gr.Chatbot()
|
| 45 |
+
# msg = gr.Textbox()
|
| 46 |
+
chatbot = gr.Chatbot([], show_label=False, elem_id="chatbot").style(min-height=30rem)
|
| 47 |
+
|
| 48 |
+
# with gr.Row():
|
| 49 |
+
with gr.Row(elem_id="prompt-container").style(mobile_collapse=False, equal_height=True):
|
| 50 |
+
with gr.Column(scale=0.85):
|
| 51 |
+
txt = gr.Textbox(
|
| 52 |
+
show_label=False,
|
| 53 |
+
placeholder="Type your response and press enter, or record your response",
|
| 54 |
+
).style(container=False)
|
| 55 |
+
with gr.Column(scale=0.15, min_width=0):
|
| 56 |
+
submit = gr.Button("Submit")
|
| 57 |
+
# gr.Interface(
|
| 58 |
+
# fn=transcribe,
|
| 59 |
+
# inputs=[
|
| 60 |
+
# gr.Audio(source="microphone", type="filepath", streaming=True),
|
| 61 |
+
# "state"
|
| 62 |
+
# ],
|
| 63 |
+
# outputs=[
|
| 64 |
+
# msg,
|
| 65 |
+
# "state"
|
| 66 |
+
# ],
|
| 67 |
+
# live=True)
|
| 68 |
+
|
| 69 |
+
txt.submit(user, [txt, chatbot], [txt, chatbot], queue=False).then(
|
| 70 |
+
bot, chatbot, chatbot
|
| 71 |
+
)
|
| 72 |
+
submit.click(user, [txt, chatbot], [txt, chatbot], queue=False).then(
|
| 73 |
+
bot, chatbot, chatbot
|
| 74 |
+
)
|
| 75 |
|
| 76 |
demo.queue()
|
| 77 |
demo.launch()
|