Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -23,6 +23,17 @@ def submit_boba_data(use_today, date, shop, drink, toppings, size, rating, price
|
|
23 |
boba_data = pd.concat([boba_data, new_entry], ignore_index=True)
|
24 |
return boba_data
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
# Define Gradio inputs and interface
|
27 |
inputs = [
|
28 |
gr.Checkbox(label="Use today's date?"),
|
|
|
23 |
boba_data = pd.concat([boba_data, new_entry], ignore_index=True)
|
24 |
return boba_data
|
25 |
|
26 |
+
def get_leaderboard():
|
27 |
+
leaderboard = boba_data.groupby('Shop').agg({'Rating': 'mean', 'Shop': 'count'}).sort_values(by='Rating', ascending=False)
|
28 |
+
return leaderboard
|
29 |
+
|
30 |
+
def get_statistics():
|
31 |
+
total_drinks = len(boba_data)
|
32 |
+
favorite_drink = boba_data['Drink'].mode()[0] if total_drinks > 0 else "No data"
|
33 |
+
total_spent = boba_data['Price'].sum()
|
34 |
+
return f"Total drinks: {total_drinks}\nFavorite drink: {favorite_drink}\nTotal spent: ${total_spent}"
|
35 |
+
|
36 |
+
|
37 |
# Define Gradio inputs and interface
|
38 |
inputs = [
|
39 |
gr.Checkbox(label="Use today's date?"),
|