Update whoop_gradio_server.py
Browse files- whoop_gradio_server.py +2 -8
whoop_gradio_server.py
CHANGED
|
@@ -42,13 +42,7 @@ def get_latest_cycle_gr():
|
|
| 42 |
end_date = datetime.now().strftime("%Y-%m-%d")
|
| 43 |
start_date = (datetime.now() - timedelta(days=1)).strftime("%Y-%m-%d")
|
| 44 |
cycles = whoop_client.get_cycle_collection(start_date, end_date)
|
| 45 |
-
|
| 46 |
-
return "β οΈ No cycle data available."
|
| 47 |
-
|
| 48 |
-
latest = cycles[0]
|
| 49 |
-
score = latest.get("score", {}).get("recovery")
|
| 50 |
-
recovery_score = f"{score}" if score is not None else "Not Available"
|
| 51 |
-
return f"π Latest Cycle:\nRecovery Score: {recovery_score}\n\nFull Data:\n{latest}"
|
| 52 |
except Exception as e:
|
| 53 |
return f"β Error: {e}"
|
| 54 |
|
|
@@ -127,7 +121,7 @@ with gr.Blocks(title="Whoop API Explorer") as demo:
|
|
| 127 |
gr.Markdown("## π Latest Recovery Cycle")
|
| 128 |
cycle_button = gr.Button("Fetch Latest Cycle")
|
| 129 |
latest_recovery = gr.Label(label="Recovery Score")
|
| 130 |
-
cycle_details = gr.Textbox(label="Full Cycle Data", visible=
|
| 131 |
|
| 132 |
with gr.Group():
|
| 133 |
gr.Markdown("## ποΈ Workout Summary")
|
|
|
|
| 42 |
end_date = datetime.now().strftime("%Y-%m-%d")
|
| 43 |
start_date = (datetime.now() - timedelta(days=1)).strftime("%Y-%m-%d")
|
| 44 |
cycles = whoop_client.get_cycle_collection(start_date, end_date)
|
| 45 |
+
return cycles
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
except Exception as e:
|
| 47 |
return f"β Error: {e}"
|
| 48 |
|
|
|
|
| 121 |
gr.Markdown("## π Latest Recovery Cycle")
|
| 122 |
cycle_button = gr.Button("Fetch Latest Cycle")
|
| 123 |
latest_recovery = gr.Label(label="Recovery Score")
|
| 124 |
+
cycle_details = gr.Textbox(label="Full Cycle Data", visible=True, lines=6)
|
| 125 |
|
| 126 |
with gr.Group():
|
| 127 |
gr.Markdown("## ποΈ Workout Summary")
|