Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -157,47 +157,33 @@ def filter_by_fields(selected_country, selected_city, selected_language):
|
|
157 |
html += "</table>"
|
158 |
return html
|
159 |
|
160 |
-
#
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
|
|
|
|
|
|
180 |
|
181 |
# Function to update the dropdown choices
|
182 |
def update_dropdown_choices():
|
183 |
-
|
184 |
-
data = json.load(f)
|
185 |
-
df = pd.DataFrame(data)
|
186 |
-
|
187 |
-
country_choices = sorted(df["Country"].dropna().unique()) if "Country" in df else []
|
188 |
-
city_choices = sorted(df["City"].dropna().unique()) if "City" in df else []
|
189 |
-
language_set = set()
|
190 |
-
if "Languages" in df:
|
191 |
-
for lang_list in df["Languages"].dropna():
|
192 |
-
if isinstance(lang_list, list):
|
193 |
-
language_set.update(lang_list)
|
194 |
-
elif isinstance(lang_list, str):
|
195 |
-
language_set.update(lang_list.split(", "))
|
196 |
-
return (
|
197 |
-
gr.update(choices=["All"] + list(country_choices), value="All"),
|
198 |
-
gr.update(choices=["All"] + list(city_choices), value="All"),
|
199 |
-
gr.update(choices=["All"] + sorted(language_set), value="All")
|
200 |
-
)
|
201 |
|
202 |
# Setup Gradio interface
|
203 |
with gr.Blocks() as demo:
|
@@ -210,7 +196,7 @@ with gr.Blocks() as demo:
|
|
210 |
name = gr.Text(label="Name")
|
211 |
discord = gr.Text(label="π€ Discord Username *")
|
212 |
city = gr.Text(label="π City *")
|
213 |
-
country = gr.Dropdown(label="π Country *", choices=
|
214 |
address = gr.Text(label="Address (optional)")
|
215 |
looking = gr.Radio(["Yes", "No"], label="π Looking for a team?")
|
216 |
onlinecheck = gr.Radio(["Participate Online", "Join a Local Hackathon"], label="π I will...")
|
|
|
157 |
html += "</table>"
|
158 |
return html
|
159 |
|
160 |
+
# List of all countries in alphabetical order
|
161 |
+
ALL_COUNTRIES = [
|
162 |
+
"Afghanistan", "Albania", "Algeria", "Andorra", "Angola", "Antigua and Barbuda", "Argentina", "Armenia", "Australia", "Austria",
|
163 |
+
"Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bhutan",
|
164 |
+
"Bolivia", "Bosnia and Herzegovina", "Botswana", "Brazil", "Brunei", "Bulgaria", "Burkina Faso", "Burundi", "Cabo Verde", "Cambodia",
|
165 |
+
"Cameroon", "Canada", "Central African Republic", "Chad", "Chile", "China", "Colombia", "Comoros", "Congo (Congo-Brazzaville)",
|
166 |
+
"Costa Rica", "Croatia", "Cuba", "Cyprus", "Czechia (Czech Republic)", "Democratic Republic of the Congo", "Denmark", "Djibouti", "Dominica",
|
167 |
+
"Dominican Republic", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Eswatini (fmr. "Swaziland")", "Ethiopia",
|
168 |
+
"Fiji", "Finland", "France", "Gabon", "Gambia", "Georgia", "Germany", "Ghana", "Greece", "Grenada",
|
169 |
+
"Guatemala", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Honduras", "Hungary", "Iceland", "India", "Indonesia",
|
170 |
+
"Iran", "Iraq", "Ireland", "Israel", "Italy", "Jamaica", "Japan", "Jordan", "Kazakhstan", "Kenya",
|
171 |
+
"Kiribati", "Korea, North", "Korea, South", "Kuwait", "Kyrgyzstan", "Laos", "Latvia", "Lebanon", "Lesotho", "Liberia",
|
172 |
+
"Libya", "Liechtenstein", "Lithuania", "Luxembourg", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta",
|
173 |
+
"Marshall Islands", "Mauritania", "Mauritius", "Mexico", "Micronesia", "Moldova", "Monaco", "Mongolia", "Montenegro", "Morocco",
|
174 |
+
"Mozambique", "Myanmar (formerly Burma)", "Namibia", "Nauru", "Nepal", "Netherlands", "New Zealand", "Nicaragua", "Niger", "Nigeria",
|
175 |
+
"North Macedonia", "Norway", "Oman", "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines",
|
176 |
+
"Poland", "Portugal", "Qatar", "Romania", "Russia", "Rwanda", "Saint Kitts and Nevis", "Saint Lucia", "Saint Vincent and the Grenadines", "Samoa",
|
177 |
+
"San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia", "Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Slovenia",
|
178 |
+
"Solomon Islands", "Somalia", "South Africa", "South Sudan", "Spain", "Sri Lanka", "Sudan", "Suriname", "Sweden", "Switzerland",
|
179 |
+
"Syria", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "Timor-Leste", "Togo", "Tonga", "Trinidad and Tobago", "Tunisia",
|
180 |
+
"Turkey", "Turkmenistan", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States of America", "Uruguay",
|
181 |
+
"Uzbekistan", "Vanuatu", "Vatican City", "Venezuela", "Vietnam", "Yemen", "Zambia", "Zimbabwe"
|
182 |
+
]
|
183 |
|
184 |
# Function to update the dropdown choices
|
185 |
def update_dropdown_choices():
|
186 |
+
return gr.update(choices=["All"] + ALL_COUNTRIES, value="All")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
|
188 |
# Setup Gradio interface
|
189 |
with gr.Blocks() as demo:
|
|
|
196 |
name = gr.Text(label="Name")
|
197 |
discord = gr.Text(label="π€ Discord Username *")
|
198 |
city = gr.Text(label="π City *")
|
199 |
+
country = gr.Dropdown(label="π Country *", choices=ALL_COUNTRIES, value="All") # Dropdown for Country
|
200 |
address = gr.Text(label="Address (optional)")
|
201 |
looking = gr.Radio(["Yes", "No"], label="π Looking for a team?")
|
202 |
onlinecheck = gr.Radio(["Participate Online", "Join a Local Hackathon"], label="π I will...")
|