Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -157,6 +157,15 @@ def filter_by_fields(selected_country, selected_city, selected_language):
|
|
157 |
html += "</table>"
|
158 |
return html
|
159 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
# Function to update the dropdown choices
|
161 |
def update_dropdown_choices():
|
162 |
with open(DATA_FILE, "r") as f:
|
@@ -189,7 +198,7 @@ with gr.Blocks() as demo:
|
|
189 |
name = gr.Text(label="Name")
|
190 |
discord = gr.Text(label="π€ Discord Username *")
|
191 |
city = gr.Text(label="π City *")
|
192 |
-
country = gr.
|
193 |
address = gr.Text(label="Address (optional)")
|
194 |
looking = gr.Radio(["Yes", "No"], label="π Looking for a team?")
|
195 |
onlinecheck = gr.Radio(["Participate Online", "Join a Local Hackathon"], label="π I will...")
|
|
|
157 |
html += "</table>"
|
158 |
return html
|
159 |
|
160 |
+
# Get the list of unique countries from existing data
|
161 |
+
def get_country_choices():
|
162 |
+
with open(DATA_FILE, "r") as f:
|
163 |
+
data = json.load(f)
|
164 |
+
df = pd.DataFrame(data)
|
165 |
+
# Get unique countries, ensuring there are no duplicates or empty values
|
166 |
+
country_choices = sorted(df["Country"].dropna().unique())
|
167 |
+
return country_choices
|
168 |
+
|
169 |
# Function to update the dropdown choices
|
170 |
def update_dropdown_choices():
|
171 |
with open(DATA_FILE, "r") as f:
|
|
|
198 |
name = gr.Text(label="Name")
|
199 |
discord = gr.Text(label="π€ Discord Username *")
|
200 |
city = gr.Text(label="π City *")
|
201 |
+
country = gr.Dropdown(label="π Country *", choices=get_country_choices(), value="All") # Dropdown for Country
|
202 |
address = gr.Text(label="Address (optional)")
|
203 |
looking = gr.Radio(["Yes", "No"], label="π Looking for a team?")
|
204 |
onlinecheck = gr.Radio(["Participate Online", "Join a Local Hackathon"], label="π I will...")
|