Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -217,6 +217,16 @@ with gr.Blocks(css=".gr-dropdown { max-height: 100px; overflow-y: auto; font-siz
|
|
| 217 |
outputs=[table_html]
|
| 218 |
)
|
| 219 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 220 |
country_filter.change(fn=update_city_filter, inputs=[country_filter], outputs=[city_filter])
|
| 221 |
for dropdown in [country_filter, city_filter, language_filter]:
|
| 222 |
dropdown.change(fn=filter_by_fields, inputs=[country_filter, city_filter, language_filter], outputs=[table_html])
|
|
|
|
| 217 |
outputs=[table_html]
|
| 218 |
)
|
| 219 |
|
| 220 |
+
def download_csv(code):
|
| 221 |
+
if code != ADMIN_CODE:
|
| 222 |
+
raise gr.Error("❌ Invalid admin code.")
|
| 223 |
+
with open(DATA_FILE, "r") as f:
|
| 224 |
+
data = json.load(f)
|
| 225 |
+
df = pd.DataFrame(data)
|
| 226 |
+
csv_path = os.path.join("data", "teamup_export.csv")
|
| 227 |
+
df.to_csv(csv_path, index=False)
|
| 228 |
+
return csv_path
|
| 229 |
+
|
| 230 |
country_filter.change(fn=update_city_filter, inputs=[country_filter], outputs=[city_filter])
|
| 231 |
for dropdown in [country_filter, city_filter, language_filter]:
|
| 232 |
dropdown.change(fn=filter_by_fields, inputs=[country_filter, city_filter, language_filter], outputs=[table_html])
|