wjm55 commited on
Commit
36b14dc
·
1 Parent(s): 71499d4
Files changed (1) hide show
  1. app.py +73 -10
app.py CHANGED
@@ -100,23 +100,86 @@ def run_example(image, model_id="Qwen/Qwen2-VL-7B-Instruct"):
100
  return output_text[0]
101
 
102
  css = """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  #output {
104
- height: 500px;
105
- overflow: auto;
106
- border: 1px solid #ccc;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  }
108
  """
109
 
110
  with gr.Blocks(css=css) as demo:
111
  gr.Image("Caracal.jpg", interactive=False)
112
- with gr.Tab(label="Image Input"):
113
  with gr.Row():
114
- with gr.Column():
115
- input_img = gr.Image(label="Input Picture")
116
- model_selector = gr.Dropdown(choices=list(models.keys()), label="Model", value="Qwen/Qwen2-VL-7B-Instruct")
117
- submit_btn = gr.Button(value="Submit")
118
- with gr.Column():
119
- output_text = gr.Textbox(label="Output Text")
120
 
121
  submit_btn.click(run_example, [input_img, model_selector], [output_text])
122
 
 
100
  return output_text[0]
101
 
102
  css = """
103
+ /* Overall app styling */
104
+ .gradio-container {
105
+ max-width: 1200px !important;
106
+ margin: 0 auto;
107
+ padding: 20px;
108
+ background-color: #f8f9fa;
109
+ }
110
+
111
+ /* Tabs styling */
112
+ .tabs {
113
+ border-radius: 8px;
114
+ background: white;
115
+ padding: 20px;
116
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
117
+ }
118
+
119
+ /* Input/Output containers */
120
+ .input-container, .output-container {
121
+ background: white;
122
+ border-radius: 8px;
123
+ padding: 15px;
124
+ margin: 10px 0;
125
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
126
+ }
127
+
128
+ /* Button styling */
129
+ .submit-btn {
130
+ background-color: #2d31fa !important;
131
+ border: none !important;
132
+ padding: 8px 20px !important;
133
+ border-radius: 6px !important;
134
+ color: white !important;
135
+ transition: all 0.3s ease !important;
136
+ }
137
+
138
+ .submit-btn:hover {
139
+ background-color: #1f24c7 !important;
140
+ transform: translateY(-1px);
141
+ }
142
+
143
+ /* Output text area */
144
  #output {
145
+ height: 500px;
146
+ overflow: auto;
147
+ border: 1px solid #e0e0e0;
148
+ border-radius: 6px;
149
+ padding: 15px;
150
+ background: #ffffff;
151
+ font-family: 'Arial', sans-serif;
152
+ }
153
+
154
+ /* Dropdown styling */
155
+ .gr-dropdown {
156
+ border-radius: 6px !important;
157
+ border: 1px solid #e0e0e0 !important;
158
+ }
159
+
160
+ /* Image upload area */
161
+ .gr-image-input {
162
+ border: 2px dashed #ccc;
163
+ border-radius: 8px;
164
+ padding: 20px;
165
+ transition: all 0.3s ease;
166
+ }
167
+
168
+ .gr-image-input:hover {
169
+ border-color: #2d31fa;
170
  }
171
  """
172
 
173
  with gr.Blocks(css=css) as demo:
174
  gr.Image("Caracal.jpg", interactive=False)
175
+ with gr.Tab(label="Image Input", elem_classes="tabs"):
176
  with gr.Row():
177
+ with gr.Column(elem_classes="input-container"):
178
+ input_img = gr.Image(label="Input Picture", elem_classes="gr-image-input")
179
+ model_selector = gr.Dropdown(choices=list(models.keys()), label="Model", value="Qwen/Qwen2-VL-7B-Instruct", elem_classes="gr-dropdown")
180
+ submit_btn = gr.Button(value="Submit", elem_classes="submit-btn")
181
+ with gr.Column(elem_classes="output-container"):
182
+ output_text = gr.Textbox(label="Output Text", elem_id="output")
183
 
184
  submit_btn.click(run_example, [input_img, model_selector], [output_text])
185