Spaces:
Build error
Build error
pgzmnk
commited on
Commit
•
7c17d65
1
Parent(s):
4b7975c
Format.
Browse files
app.py
CHANGED
@@ -321,9 +321,11 @@ def push_to_md():
|
|
321 |
|
322 |
|
323 |
def motherduck_list_projects(author_id):
|
324 |
-
return con.sql(
|
|
|
325 |
SELECT DISTINCT name FROM project WHERE authorId = '{author_id}'
|
326 |
-
"""
|
|
|
327 |
|
328 |
|
329 |
with gr.Blocks() as demo:
|
@@ -374,10 +376,8 @@ with gr.Blocks() as demo:
|
|
374 |
save_btn.click(push_to_md)
|
375 |
|
376 |
def update_project_dropdown_list(url_params):
|
377 |
-
|
378 |
-
|
379 |
-
projects = motherduck_list_projects(author_id = url_params['username'])
|
380 |
-
print('projects', projects)
|
381 |
# to-do: filter projects based on user
|
382 |
return gr.Dropdown.update(choices=projects["name"].tolist())
|
383 |
|
|
|
321 |
|
322 |
|
323 |
def motherduck_list_projects(author_id):
|
324 |
+
return con.sql(
|
325 |
+
f"""
|
326 |
SELECT DISTINCT name FROM project WHERE authorId = '{author_id}'
|
327 |
+
"""
|
328 |
+
).df()
|
329 |
|
330 |
|
331 |
with gr.Blocks() as demo:
|
|
|
376 |
save_btn.click(push_to_md)
|
377 |
|
378 |
def update_project_dropdown_list(url_params):
|
379 |
+
username = url_params.get("username", "default")
|
380 |
+
projects = motherduck_list_projects(author_id=username)
|
|
|
|
|
381 |
# to-do: filter projects based on user
|
382 |
return gr.Dropdown.update(choices=projects["name"].tolist())
|
383 |
|