Update app.py
Browse files
app.py
CHANGED
|
@@ -4,18 +4,23 @@ from inference import inference
|
|
| 4 |
theme = theme = gr.themes.Soft(
|
| 5 |
primary_hue="red",
|
| 6 |
secondary_hue="red",
|
| 7 |
-
|
|
|
|
| 8 |
|
| 9 |
-
with gr.Blocks(theme = theme) as demo:
|
| 10 |
-
with gr.Row():
|
| 11 |
-
gr.HTML("""
|
| 12 |
-
<div style="display: flex; align-items: center;">
|
| 13 |
-
<img src="https://ticio.co/public/Branding/ticio.svg" alt="Logo" style="width: 50px; height: auto; margin-right: 10px;">
|
| 14 |
-
<h1 style="color: #910A0A; margin: 0;">Ticio</h1>
|
| 15 |
-
</div>
|
| 16 |
-
""") # Replace with your logo image URL
|
| 17 |
-
chatbot = gr.Chatbot(type="messages")
|
| 18 |
-
hidden_text = gr.Textbox(visible = False) # Added hidden text component
|
| 19 |
-
gr.ChatInterface(fn=inference, chatbot=chatbot, type="messages", additional_inputs= hidden_text, additional_outputs= hidden_text, save_history= True).render()
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
demo.launch()
|
|
|
|
| 4 |
theme = theme = gr.themes.Soft(
|
| 5 |
primary_hue="red",
|
| 6 |
secondary_hue="red",
|
| 7 |
+
mode="light"
|
| 8 |
+
)
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
+
with gr.Blocks(theme = theme, dark_mode = False) as demo:
|
| 12 |
+
chatbot = gr.Chatbot(type="messages", label="Chat")
|
| 13 |
+
msg = gr.Textbox()
|
| 14 |
+
ctx = gr.Textbox(visible=False, value="")
|
| 15 |
+
send = gr.Button("Send")
|
| 16 |
+
|
| 17 |
+
# inputs -> [chatbot (history), msg (query), ctx (context)]
|
| 18 |
+
# outputs -> [chatbot (updated history), ctx (updated context if you want)]
|
| 19 |
+
send.click(
|
| 20 |
+
inference,
|
| 21 |
+
inputs=[chatbot, msg, ctx],
|
| 22 |
+
outputs=[chatbot, ctx]
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
demo.launch()
|
| 26 |
demo.launch()
|