Aadarshwahmare commited on
Commit
3160578
·
verified ·
1 Parent(s): 049ce6f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -15
app.py CHANGED
@@ -5,27 +5,31 @@ import os
5
  # Configure API key
6
  genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
7
 
8
- model = genai.GenerativeModel("gemini-pro")
9
 
10
  def fitness_coach(age, weight, goal, activity):
11
- prompt = f"""
12
- You are a certified fitness coach and nutrition expert.
 
13
 
14
- Create a personalized fitness plan:
15
 
16
- Age: {age}
17
- Weight: {weight}
18
- Goal: {goal}
19
- Activity Level: {activity}
20
 
21
- Include:
22
- 1. Workout Plan
23
- 2. Diet Plan
24
- 3. Tips
25
- """
26
 
27
- response = model.generate_content(prompt)
28
- return response.text
 
 
 
29
 
30
  interface = gr.Interface(
31
  fn=fitness_coach,
 
5
  # Configure API key
6
  genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
7
 
8
+ model = genai.GenerativeModel("gemini-1.5-flash")
9
 
10
  def fitness_coach(age, weight, goal, activity):
11
+ try:
12
+ prompt = f"""
13
+ You are a certified fitness coach and nutrition expert.
14
 
15
+ Create a personalized fitness plan:
16
 
17
+ Age: {age}
18
+ Weight: {weight}
19
+ Goal: {goal}
20
+ Activity Level: {activity}
21
 
22
+ Include:
23
+ 1. Workout Plan
24
+ 2. Diet Plan
25
+ 3. Tips
26
+ """
27
 
28
+ response = model.generate_content(prompt)
29
+ return response.text
30
+
31
+ except Exception as e:
32
+ return f"Error: {str(e)}"
33
 
34
  interface = gr.Interface(
35
  fn=fitness_coach,