minemaster01 commited on
Commit
9968bbc
·
verified ·
1 Parent(s): 05fb91e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +55 -69
app.py CHANGED
@@ -153,82 +153,68 @@ with gr.Blocks() as gradio_app:
153
  gr.Markdown("# South Asian Image Data Collection")
154
  gr.Markdown("Upload an image and answer questions about its cultural significance.")
155
 
 
156
  with gr.Row():
157
- input_img = gr.Image(label="Upload an image", sources=['upload', 'webcam'], type="pil")
158
-
159
- with gr.Row():
160
- text_answer = gr.Textbox(label="The image portrays culturally-relevant information in:", placeholder="what culture does this image represent?")
161
-
162
- with gr.Row():
163
- country_dropdown = gr.Dropdown(
164
- choices=["India", "Pakistan", "Bangladesh", "Afghanistan", "Bhutan", "Nepal", "Sri Lanka"],
165
- label="Country where the image was taken:",
166
- interactive=True
167
- )
168
-
169
- with gr.Row():
170
- state_dropdown = gr.Dropdown(
171
- choices=[],
172
- label="State/Province:",
173
- interactive=True
174
- )
175
-
176
- with gr.Row():
177
- city_textbox = gr.Textbox(label="City where the image was taken:", placeholder="Enter city name")
178
-
179
- with gr.Row():
180
- se_asia_relevance = gr.Radio(
181
- choices=[
182
- "Yes. Unique to South Asia",
183
- "Yes, people will likely think of South Asia when seeing the picture, but it may have low degree of similarity to other cultures.",
184
- "Maybe, this culture did not originate from South Asia, but it's quite dominant in South Asia",
185
- "Not really. It has some affiliation to South Asia, but actually does not represent South Asia or has stronger affiliation to cultures outside South Asia",
186
- "No. Totally unrelated to South Asia"
187
- ],
188
- label="Is the image culturally relevant in South Asia?"
189
- )
190
-
191
- with gr.Row():
192
- culture_knowledge = gr.Radio(
193
- choices=[
194
- "I'm from this country/culture",
195
- "I checked online resources (e.g., Wikipedia, articles, blogs)"
196
- ],
197
- label="How do you know about this culture?",
198
- info="Please do not consult LLMs (e.g., GPT-4o, Claude, Command-R, etc.)"
199
- )
200
-
201
- with gr.Row():
202
- native_caption = gr.Textbox(label="Caption in Native Language:", placeholder="Enter caption in the native language of the culture depicted")
203
-
204
- with gr.Row():
205
- english_caption = gr.Textbox(label="English Caption:", placeholder="Enter caption in English")
206
 
207
- # Buttons row - "Share via Link" button removed
208
  with gr.Row():
209
  clear_btn = gr.Button("Clear")
210
  submit_btn = gr.Button("Submit")
211
 
 
212
  with gr.Row():
213
- output_img = gr.Image(label="Submitted Image")
214
-
215
- with gr.Row():
216
- output_text = gr.Text(label="Text Response")
217
-
218
- with gr.Row():
219
- output_location = gr.Text(label="Location Information")
220
-
221
- with gr.Row():
222
- output_relevance = gr.Text(label="South Asia Cultural Relevance")
223
-
224
- with gr.Row():
225
- output_knowledge = gr.Text(label="Cultural Knowledge Source")
226
-
227
- with gr.Row():
228
- output_native = gr.Text(label="Native Language Caption")
229
-
230
- with gr.Row():
231
- output_english = gr.Text(label="English Caption")
232
 
233
  # Set up event handlers
234
  country_dropdown.change(
 
153
  gr.Markdown("# South Asian Image Data Collection")
154
  gr.Markdown("Upload an image and answer questions about its cultural significance.")
155
 
156
+ # Split the interface into two columns
157
  with gr.Row():
158
+ # Left column for image upload and basic information
159
+ with gr.Column(scale=1):
160
+ input_img = gr.Image(label="Upload an image", sources=['upload', 'webcam'], type="pil")
161
+ text_answer = gr.Textbox(label="The image portrays culturally-relevant information in:", placeholder="what culture does this image represent?")
162
+
163
+ # Location information in the left column
164
+ country_dropdown = gr.Dropdown(
165
+ choices=["India", "Pakistan", "Bangladesh", "Afghanistan", "Bhutan", "Nepal", "Sri Lanka"],
166
+ label="Country where the image was taken:",
167
+ interactive=True
168
+ )
169
+ state_dropdown = gr.Dropdown(
170
+ choices=[],
171
+ label="State/Province:",
172
+ interactive=True
173
+ )
174
+ city_textbox = gr.Textbox(label="City where the image was taken:", placeholder="Enter city name")
175
+
176
+ # Right column for additional information
177
+ with gr.Column(scale=1):
178
+ se_asia_relevance = gr.Radio(
179
+ choices=[
180
+ "Yes. Unique to South Asia",
181
+ "Yes, people will likely think of South Asia when seeing the picture, but it may have low degree of similarity to other cultures.",
182
+ "Maybe, this culture did not originate from South Asia, but it's quite dominant in South Asia",
183
+ "Not really. It has some affiliation to South Asia, but actually does not represent South Asia or has stronger affiliation to cultures outside South Asia",
184
+ "No. Totally unrelated to South Asia"
185
+ ],
186
+ label="Is the image culturally relevant in South Asia?"
187
+ )
188
+
189
+ culture_knowledge = gr.Radio(
190
+ choices=[
191
+ "I'm from this country/culture",
192
+ "I checked online resources (e.g., Wikipedia, articles, blogs)"
193
+ ],
194
+ label="How do you know about this culture?",
195
+ info="Please do not consult LLMs (e.g., GPT-4o, Claude, Command-R, etc.)"
196
+ )
197
+
198
+ native_caption = gr.Textbox(label="Caption in Native Language:", placeholder="Enter caption in the native language of the culture depicted")
199
+ english_caption = gr.Textbox(label="English Caption:", placeholder="Enter caption in English")
 
 
 
 
 
 
 
200
 
201
+ # Buttons row
202
  with gr.Row():
203
  clear_btn = gr.Button("Clear")
204
  submit_btn = gr.Button("Submit")
205
 
206
+ # Output display section - also split into two columns
207
  with gr.Row():
208
+ with gr.Column(scale=1):
209
+ output_img = gr.Image(label="Submitted Image")
210
+ output_text = gr.Text(label="Text Response")
211
+ output_location = gr.Text(label="Location Information")
212
+
213
+ with gr.Column(scale=1):
214
+ output_relevance = gr.Text(label="South Asia Cultural Relevance")
215
+ output_knowledge = gr.Text(label="Cultural Knowledge Source")
216
+ output_native = gr.Text(label="Native Language Caption")
217
+ output_english = gr.Text(label="English Caption")
 
 
 
 
 
 
 
 
 
218
 
219
  # Set up event handlers
220
  country_dropdown.change(