Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,22 +17,26 @@ def add_participant(participant):
|
|
| 17 |
participants_text = "\n".join(participants_list)
|
| 18 |
|
| 19 |
# Return updated participant list for dropdowns
|
| 20 |
-
return
|
| 21 |
-
|
|
|
|
| 22 |
gr.Dropdown.update(choices=participants_list)
|
|
|
|
| 23 |
|
| 24 |
def remove_participant(participant):
|
| 25 |
global participants_set
|
| 26 |
participant = participant.strip()
|
| 27 |
if participant in participants_set:
|
| 28 |
participants_set.remove(participant)
|
| 29 |
-
participants_list = sorted(list(participants_set))
|
| 30 |
participants_text = "\n".join(participants_list)
|
| 31 |
|
| 32 |
# Return updated participant list for dropdowns
|
| 33 |
-
return
|
| 34 |
-
|
|
|
|
| 35 |
gr.Dropdown.update(choices=participants_list)
|
|
|
|
| 36 |
|
| 37 |
# Add expenses
|
| 38 |
def add_expense(description, amount, payer, participants_list):
|
|
@@ -133,9 +137,13 @@ def reset():
|
|
| 133 |
participants_set = set()
|
| 134 |
participants_list = []
|
| 135 |
participants_text = ""
|
| 136 |
-
return
|
| 137 |
-
|
|
|
|
|
|
|
|
|
|
| 138 |
gr.Dropdown.update(choices=participants_list, value=None)
|
|
|
|
| 139 |
|
| 140 |
# Gradio Interface
|
| 141 |
with gr.Blocks(theme='soft') as app:
|
|
@@ -217,4 +225,4 @@ with gr.Blocks(theme='soft') as app:
|
|
| 217 |
|
| 218 |
# Launch the app
|
| 219 |
if __name__ == "__main__":
|
| 220 |
-
app.launch(share=True)
|
|
|
|
| 17 |
participants_text = "\n".join(participants_list)
|
| 18 |
|
| 19 |
# Return updated participant list for dropdowns
|
| 20 |
+
return (
|
| 21 |
+
participants_text,
|
| 22 |
+
gr.Dropdown.update(choices=participants_list),
|
| 23 |
gr.Dropdown.update(choices=participants_list)
|
| 24 |
+
)
|
| 25 |
|
| 26 |
def remove_participant(participant):
|
| 27 |
global participants_set
|
| 28 |
participant = participant.strip()
|
| 29 |
if participant in participants_set:
|
| 30 |
participants_set.remove(participant)
|
| 31 |
+
participants_list = sorted(list(participants_set))
|
| 32 |
participants_text = "\n".join(participants_list)
|
| 33 |
|
| 34 |
# Return updated participant list for dropdowns
|
| 35 |
+
return (
|
| 36 |
+
participants_text,
|
| 37 |
+
gr.Dropdown.update(choices=participants_list),
|
| 38 |
gr.Dropdown.update(choices=participants_list)
|
| 39 |
+
)
|
| 40 |
|
| 41 |
# Add expenses
|
| 42 |
def add_expense(description, amount, payer, participants_list):
|
|
|
|
| 137 |
participants_set = set()
|
| 138 |
participants_list = []
|
| 139 |
participants_text = ""
|
| 140 |
+
return (
|
| 141 |
+
pd.DataFrame(expenses),
|
| 142 |
+
[],
|
| 143 |
+
participants_text,
|
| 144 |
+
gr.Dropdown.update(choices=participants_list, value=None),
|
| 145 |
gr.Dropdown.update(choices=participants_list, value=None)
|
| 146 |
+
)
|
| 147 |
|
| 148 |
# Gradio Interface
|
| 149 |
with gr.Blocks(theme='soft') as app:
|
|
|
|
| 225 |
|
| 226 |
# Launch the app
|
| 227 |
if __name__ == "__main__":
|
| 228 |
+
app.launch(share=True)
|