maringetxway commited on
Commit
f6376cc
Β·
verified Β·
1 Parent(s): 2b22ecd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
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.Text(label="🌍 Country *")
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...")