Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
"
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
"
|
195 |
-
|
196 |
-
|
197 |
-
label="
|
198 |
-
|
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
|
208 |
with gr.Row():
|
209 |
clear_btn = gr.Button("Clear")
|
210 |
submit_btn = gr.Button("Submit")
|
211 |
|
|
|
212 |
with gr.Row():
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
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(
|