Spaces:
Sleeping
Sleeping
Commit ·
4b24f62
1
Parent(s): 75a88f9
Update app.py
Browse files
app.py
CHANGED
|
@@ -281,25 +281,60 @@ def generate_reply_attn(user_text: str) -> str:
|
|
| 281 |
|
| 282 |
# ------------- Gradio ChatInterface -------------
|
| 283 |
with gr.Blocks() as demo:
|
| 284 |
-
gr.Markdown("# Ubuntu Chatbot Comparison — No Attention vs Attention")
|
| 285 |
|
| 286 |
with gr.Row():
|
| 287 |
-
|
| 288 |
-
#
|
| 289 |
-
with gr.Column():
|
| 290 |
-
gr.Markdown("### No Attention Model")
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
gr.
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 303 |
|
| 304 |
if __name__ == "__main__":
|
| 305 |
-
demo.launch()
|
|
|
|
| 281 |
|
| 282 |
# ------------- Gradio ChatInterface -------------
|
| 283 |
with gr.Blocks() as demo:
|
| 284 |
+
gr.Markdown("# **Ubuntu Chatbot Comparison — No Attention vs Attention**")
|
| 285 |
|
| 286 |
with gr.Row():
|
| 287 |
+
|
| 288 |
+
# ---------- LEFT: No Attention ----------
|
| 289 |
+
with gr.Column(scale=1):
|
| 290 |
+
gr.Markdown("### **No Attention Model**")
|
| 291 |
+
|
| 292 |
+
chatbox1 = gr.Textbox(
|
| 293 |
+
label="Bot Reply (No-Attention)",
|
| 294 |
+
lines=8,
|
| 295 |
+
interactive=False
|
| 296 |
+
)
|
| 297 |
+
|
| 298 |
+
user_input1 = gr.Textbox(
|
| 299 |
+
label="Your Message",
|
| 300 |
+
placeholder="Type a message for the NO-ATTN model...",
|
| 301 |
+
lines=2
|
| 302 |
+
)
|
| 303 |
+
|
| 304 |
+
send1 = gr.Button("Send")
|
| 305 |
+
|
| 306 |
+
# User clicks send → reply appears in big chat window
|
| 307 |
+
send1.click(
|
| 308 |
+
fn=generate_reply_no_attn,
|
| 309 |
+
inputs=user_input1,
|
| 310 |
+
outputs=chatbox1
|
| 311 |
+
)
|
| 312 |
+
|
| 313 |
+
|
| 314 |
+
# ---------- RIGHT: With Attention ----------
|
| 315 |
+
with gr.Column(scale=1):
|
| 316 |
+
gr.Markdown("### **Attention Model**")
|
| 317 |
+
|
| 318 |
+
chatbox2 = gr.Textbox(
|
| 319 |
+
label="Bot Reply (Attention)",
|
| 320 |
+
lines=8,
|
| 321 |
+
interactive=False
|
| 322 |
+
)
|
| 323 |
+
|
| 324 |
+
user_input2 = gr.Textbox(
|
| 325 |
+
label="Your Message",
|
| 326 |
+
placeholder="Type a message for the ATTENTION model...",
|
| 327 |
+
lines=2
|
| 328 |
+
)
|
| 329 |
+
|
| 330 |
+
send2 = gr.Button("Send")
|
| 331 |
+
|
| 332 |
+
send2.click(
|
| 333 |
+
fn=generate_reply_attn,
|
| 334 |
+
inputs=user_input2,
|
| 335 |
+
outputs=chatbox2
|
| 336 |
+
)
|
| 337 |
+
|
| 338 |
|
| 339 |
if __name__ == "__main__":
|
| 340 |
+
demo.launch()
|