Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
|
| 2 |
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, pipeline
|
| 3 |
|
| 4 |
# Load a lightweight, CPU-friendly model
|
|
@@ -77,7 +77,6 @@ with gr.Blocks(title="Cinco Returns Chatbot") as demo:
|
|
| 77 |
gr.Markdown("""
|
| 78 |
# 🧾 Cinco Returns Chatbot
|
| 79 |
Welcome to the Cinco Returns Assistant. Ask your questions about returns, refunds, and exchanges.
|
| 80 |
-
|
| 81 |
### 💬 Example Questions:
|
| 82 |
- *Can I return a sweater I no longer want?*
|
| 83 |
- *What if I don’t have a receipt?*
|
|
@@ -98,17 +97,16 @@ with gr.Blocks(title="Cinco Returns Chatbot") as demo:
|
|
| 98 |
|
| 99 |
state = gr.State([])
|
| 100 |
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
)
|
| 106 |
-
user_input.submit(
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
)
|
| 111 |
-
|
| 112 |
|
| 113 |
gr.Markdown("""
|
| 114 |
---
|
|
|
|
| 1 |
+
mport gradio as gr
|
| 2 |
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, pipeline
|
| 3 |
|
| 4 |
# Load a lightweight, CPU-friendly model
|
|
|
|
| 77 |
gr.Markdown("""
|
| 78 |
# 🧾 Cinco Returns Chatbot
|
| 79 |
Welcome to the Cinco Returns Assistant. Ask your questions about returns, refunds, and exchanges.
|
|
|
|
| 80 |
### 💬 Example Questions:
|
| 81 |
- *Can I return a sweater I no longer want?*
|
| 82 |
- *What if I don’t have a receipt?*
|
|
|
|
| 97 |
|
| 98 |
state = gr.State([])
|
| 99 |
|
| 100 |
+
submit_btn.click(
|
| 101 |
+
fn=chat_fn,
|
| 102 |
+
inputs=[user_input, state],
|
| 103 |
+
outputs=[user_input, state, chatbot_ui] # return updated chat history to both state and UI
|
| 104 |
+
)
|
| 105 |
+
user_input.submit(
|
| 106 |
+
fn=chat_fn,
|
| 107 |
+
inputs=[user_input, state],
|
| 108 |
+
outputs=[user_input, state, chatbot_ui]
|
| 109 |
+
)
|
|
|
|
| 110 |
|
| 111 |
gr.Markdown("""
|
| 112 |
---
|