Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -74,7 +74,7 @@ def update_state_dropdown(country):
|
|
74 |
return gr.Dropdown(choices=states_by_country[country], label=f"State/Province in {country}:", interactive=True)
|
75 |
return gr.Dropdown(choices=[], label="State/Province:", interactive=True)
|
76 |
|
77 |
-
def process_submission(input_img, text_answer, country, state, city, se_asia_relevance, culture_knowledge, native_caption, english_caption):
|
78 |
# Generate unique ID for this submission
|
79 |
submission_id = str(uuid.uuid4())
|
80 |
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
@@ -104,7 +104,8 @@ def process_submission(input_img, text_answer, country, state, city, se_asia_rel
|
|
104 |
"se_asia_relevance": se_asia_relevance,
|
105 |
"cultural_knowledge_source": culture_knowledge,
|
106 |
"native_caption": native_caption,
|
107 |
-
"english_caption": english_caption
|
|
|
108 |
}
|
109 |
|
110 |
# Save the data as JSON
|
@@ -143,7 +144,7 @@ def process_submission(input_img, text_answer, country, state, city, se_asia_rel
|
|
143 |
return input_img, f"Your text response: {text_answer}", f"Selected location: {location_info}", f"SE Asia relevance: {se_asia_relevance}", f"Cultural knowledge source: {culture_knowledge}", f"Native caption: {native_caption}", f"English caption: {english_caption}"
|
144 |
|
145 |
def clear_inputs():
|
146 |
-
return None, "", None, None, "", None, None, "", ""
|
147 |
|
148 |
# Initialize the dataset
|
149 |
setup_hf_dataset()
|
@@ -171,6 +172,7 @@ with gr.Blocks() as gradio_app:
|
|
171 |
interactive=True
|
172 |
)
|
173 |
city_textbox = gr.Textbox(label="City where the image was taken:", placeholder="Enter city name")
|
|
|
174 |
|
175 |
# Right column for additional information
|
176 |
with gr.Column(scale=1):
|
@@ -233,7 +235,8 @@ with gr.Blocks() as gradio_app:
|
|
233 |
se_asia_relevance,
|
234 |
culture_knowledge,
|
235 |
native_caption,
|
236 |
-
english_caption
|
|
|
237 |
],
|
238 |
outputs=[
|
239 |
output_img,
|
@@ -258,7 +261,8 @@ with gr.Blocks() as gradio_app:
|
|
258 |
se_asia_relevance,
|
259 |
culture_knowledge,
|
260 |
native_caption,
|
261 |
-
english_caption
|
|
|
262 |
]
|
263 |
)
|
264 |
|
|
|
74 |
return gr.Dropdown(choices=states_by_country[country], label=f"State/Province in {country}:", interactive=True)
|
75 |
return gr.Dropdown(choices=[], label="State/Province:", interactive=True)
|
76 |
|
77 |
+
def process_submission(input_img, text_answer, country, state, city, se_asia_relevance, culture_knowledge, native_caption, english_caption,email):
|
78 |
# Generate unique ID for this submission
|
79 |
submission_id = str(uuid.uuid4())
|
80 |
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
|
|
104 |
"se_asia_relevance": se_asia_relevance,
|
105 |
"cultural_knowledge_source": culture_knowledge,
|
106 |
"native_caption": native_caption,
|
107 |
+
"english_caption": english_caption,
|
108 |
+
"email": email
|
109 |
}
|
110 |
|
111 |
# Save the data as JSON
|
|
|
144 |
return input_img, f"Your text response: {text_answer}", f"Selected location: {location_info}", f"SE Asia relevance: {se_asia_relevance}", f"Cultural knowledge source: {culture_knowledge}", f"Native caption: {native_caption}", f"English caption: {english_caption}"
|
145 |
|
146 |
def clear_inputs():
|
147 |
+
return None, "", None, None, "", None, None, "", "", ""
|
148 |
|
149 |
# Initialize the dataset
|
150 |
setup_hf_dataset()
|
|
|
172 |
interactive=True
|
173 |
)
|
174 |
city_textbox = gr.Textbox(label="City where the image was taken:", placeholder="Enter city name")
|
175 |
+
email_input = gr.Textbox(label="Your Email:", placeholder="Enter your email address", info="Used as unique contributor ID")
|
176 |
|
177 |
# Right column for additional information
|
178 |
with gr.Column(scale=1):
|
|
|
235 |
se_asia_relevance,
|
236 |
culture_knowledge,
|
237 |
native_caption,
|
238 |
+
english_caption,
|
239 |
+
email_input
|
240 |
],
|
241 |
outputs=[
|
242 |
output_img,
|
|
|
261 |
se_asia_relevance,
|
262 |
culture_knowledge,
|
263 |
native_caption,
|
264 |
+
english_caption,
|
265 |
+
email_input
|
266 |
]
|
267 |
)
|
268 |
|