KarthiEz commited on
Commit
795beee
·
verified ·
1 Parent(s): d08f6b7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -11
app.py CHANGED
@@ -65,16 +65,17 @@ def ask_about_image(image, prompt):
65
 
66
  with gr.Blocks(css="""
67
  #resp_box textarea {
68
- min-height: 96px; /* ~4 lines baseline */
69
- max-height: 180px; /* modest growth headroom */
70
- overflow: auto; /* scroll after cap */
71
- resize: none; /* lock user-resize */
72
- line-height: 1.2; /* compact spacing */
73
- white-space: pre-wrap;/* wrap long lines nicely */
74
  }
75
  #resp_box label { margin-bottom: 4px; }
76
  """) as demo:
77
  gr.Markdown("## 🧠 Qwen2.5-VL-3B — Visual Reasoning Assistant")
 
78
  with gr.Row():
79
  image = gr.Image(type="pil", label="Upload an Image")
80
  with gr.Column():
@@ -84,15 +85,17 @@ with gr.Blocks(css="""
84
  )
85
  ask_button = gr.Button("Ask")
86
 
87
- # Compact, model-only response pane
88
  answer = gr.Textbox(
89
  label="Response",
90
- lines=4, # initial height only (no autogrow used)
91
- interactive=False, # model-managed; user can't edit
92
- elem_id="resp_box" # scoped styling
93
  )
94
 
95
- ask_button.click(ask_about_image, [image, question], answer)
 
96
 
97
  demo.launch()
98
 
 
 
65
 
66
  with gr.Blocks(css="""
67
  #resp_box textarea {
68
+ min-height: 96px;
69
+ max-height: 180px;
70
+ overflow: auto;
71
+ resize: none;
72
+ line-height: 1.2;
73
+ white-space: pre-wrap;
74
  }
75
  #resp_box label { margin-bottom: 4px; }
76
  """) as demo:
77
  gr.Markdown("## 🧠 Qwen2.5-VL-3B — Visual Reasoning Assistant")
78
+
79
  with gr.Row():
80
  image = gr.Image(type="pil", label="Upload an Image")
81
  with gr.Column():
 
85
  )
86
  ask_button = gr.Button("Ask")
87
 
88
+ # Compact area showing only the assistant’s answer
89
  answer = gr.Textbox(
90
  label="Response",
91
+ lines=4,
92
+ interactive=False, # user cannot edit
93
+ elem_id="resp_box"
94
  )
95
 
96
+ # The model’s pure output only
97
+ ask_button.click(fn=ask_about_image, inputs=[image, question], outputs=[answer])
98
 
99
  demo.launch()
100
 
101
+