Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -98,17 +98,17 @@ def show_map(date_str, rep):
|
|
| 98 |
lat="Latitude", lon="Longitude",
|
| 99 |
text=["End"], color_discrete_sequence=["red"]).data[0])
|
| 100 |
|
| 101 |
-
fig.update_layout(mapbox_style="open-street-map", title=f"
|
| 102 |
|
| 103 |
table = subset[[
|
| 104 |
'Visit Order', 'Dealership', 'Time', 'Time Diff (min)',
|
| 105 |
'Interaction Type', 'Product'
|
| 106 |
]].rename(columns={
|
| 107 |
-
'Dealership': '
|
| 108 |
-
'Time': '
|
| 109 |
-
'Time Diff (min)': '
|
| 110 |
-
'Interaction Type': '
|
| 111 |
-
'Product': '
|
| 112 |
})
|
| 113 |
|
| 114 |
total_time = round(table['β±οΈ Time Spent'].sum(), 2)
|
|
@@ -160,7 +160,7 @@ with gr.Blocks() as app:
|
|
| 160 |
with gr.Tab("π Reports"):
|
| 161 |
with gr.Row():
|
| 162 |
report_type = gr.Radio(choices=["Daily", "Weekly", "Monthly"], label="Report Type", value="Daily")
|
| 163 |
-
report_date = gr.
|
| 164 |
download_btn = gr.Button("π₯ Download CSV")
|
| 165 |
|
| 166 |
report_table = gr.Dataframe(label="π Report Summary")
|
|
@@ -170,7 +170,7 @@ with gr.Blocks() as app:
|
|
| 170 |
def generate_report(report_type, report_date):
|
| 171 |
df = refresh_data()
|
| 172 |
try:
|
| 173 |
-
date_obj = pd.to_datetime(str(report_date))
|
| 174 |
except:
|
| 175 |
return pd.DataFrame(), "β οΈ Invalid date format.", None
|
| 176 |
|
|
|
|
| 98 |
lat="Latitude", lon="Longitude",
|
| 99 |
text=["End"], color_discrete_sequence=["red"]).data[0])
|
| 100 |
|
| 101 |
+
fig.update_layout(mapbox_style="open-street-map", title=f"\U0001F4CD {rep}'s Route on {date_str}")
|
| 102 |
|
| 103 |
table = subset[[
|
| 104 |
'Visit Order', 'Dealership', 'Time', 'Time Diff (min)',
|
| 105 |
'Interaction Type', 'Product'
|
| 106 |
]].rename(columns={
|
| 107 |
+
'Dealership': '\U0001F9ED Dealer',
|
| 108 |
+
'Time': '\U0001F552 Time',
|
| 109 |
+
'Time Diff (min)': '\u23F1\ufe0f Time Spent',
|
| 110 |
+
'Interaction Type': '\ud83d\udcde Interaction',
|
| 111 |
+
'Product': '\ud83d\udcbc Product Type'
|
| 112 |
})
|
| 113 |
|
| 114 |
total_time = round(table['β±οΈ Time Spent'].sum(), 2)
|
|
|
|
| 160 |
with gr.Tab("π Reports"):
|
| 161 |
with gr.Row():
|
| 162 |
report_type = gr.Radio(choices=["Daily", "Weekly", "Monthly"], label="Report Type", value="Daily")
|
| 163 |
+
report_date = gr.Textbox(label="Enter Date (YYYY-MM-DD)", placeholder="2025-05-27")
|
| 164 |
download_btn = gr.Button("π₯ Download CSV")
|
| 165 |
|
| 166 |
report_table = gr.Dataframe(label="π Report Summary")
|
|
|
|
| 170 |
def generate_report(report_type, report_date):
|
| 171 |
df = refresh_data()
|
| 172 |
try:
|
| 173 |
+
date_obj = pd.to_datetime(str(report_date), errors='coerce')
|
| 174 |
except:
|
| 175 |
return pd.DataFrame(), "β οΈ Invalid date format.", None
|
| 176 |
|