Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -87,7 +87,7 @@ class PredictResponse(BaseModel):
|
|
| 87 |
def get_suitable_exercises(workout_type: int, mood: int, soreness: int):
|
| 88 |
supabase = create_client(os.getenv('SUPA_URL'), os.getenv('SUPA_KEY'))
|
| 89 |
|
| 90 |
-
|
| 91 |
supabase.table('exerciseai')
|
| 92 |
.select('*')
|
| 93 |
.eq('workout_type', workout_type)
|
|
@@ -95,8 +95,10 @@ def get_suitable_exercises(workout_type: int, mood: int, soreness: int):
|
|
| 95 |
.contains('suitable_soreness', [str(soreness)])
|
| 96 |
.execute()
|
| 97 |
)
|
| 98 |
-
|
| 99 |
-
|
|
|
|
|
|
|
| 100 |
|
| 101 |
@app.get("/")
|
| 102 |
def greet_json():
|
|
|
|
| 87 |
def get_suitable_exercises(workout_type: int, mood: int, soreness: int):
|
| 88 |
supabase = create_client(os.getenv('SUPA_URL'), os.getenv('SUPA_KEY'))
|
| 89 |
|
| 90 |
+
supabase_response = (
|
| 91 |
supabase.table('exerciseai')
|
| 92 |
.select('*')
|
| 93 |
.eq('workout_type', workout_type)
|
|
|
|
| 95 |
.contains('suitable_soreness', [str(soreness)])
|
| 96 |
.execute()
|
| 97 |
)
|
| 98 |
+
|
| 99 |
+
# Parse Supabase response into ExerciseResponse objects
|
| 100 |
+
exercises = [ExerciseResponse(**exercise) for exercise in supabase_response.data]
|
| 101 |
+
return exercises
|
| 102 |
|
| 103 |
@app.get("/")
|
| 104 |
def greet_json():
|