amaresh8053 commited on
Commit
4b24f62
·
1 Parent(s): 75a88f9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +53 -18
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
- # Left column No Attention model
289
- with gr.Column():
290
- gr.Markdown("### No Attention Model")
291
- inp1 = gr.Textbox(label="Your question (No-Attn)", placeholder="Type here...")
292
- out1 = gr.Textbox(label="Bot Reply (No-Attn)")
293
- btn1 = gr.Button("Ask No-Attn Bot")
294
- btn1.click(fn=generate_reply_no_attn, inputs=inp1, outputs=out1)
295
-
296
- # Right column — Attention model
297
- with gr.Column():
298
- gr.Markdown("### Attention Model")
299
- inp2 = gr.Textbox(label="Your question (Attn)", placeholder="Type here...")
300
- out2 = gr.Textbox(label="Bot Reply (Attn)")
301
- btn2 = gr.Button("Ask Attn Bot")
302
- btn2.click(fn=generate_reply_attn, inputs=inp2, outputs=out2)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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()