bkbilal09 commited on
Commit
0d515e2
·
verified ·
1 Parent(s): cce89e9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -6,8 +6,8 @@ import gradio as gr
6
  # 1. CLOUD SETTINGS & SECURITY INITIALIZATION
7
  # ==========================================
8
  GROQ_API_KEY = os.environ.get("GROQ_API_KEY")
9
- # Switching to a model with higher/more stable token limits on Groq free tier
10
- LLM_MODEL = "llama3-70b-8192"
11
 
12
  # ==========================================
13
  # 2. EXTENSIVE DATA TEMPLATE (Deep Research Source)
@@ -95,7 +95,7 @@ def practical_simulation_engine(pressure, temp, moisture):
95
  {"role": "user", "content": user_prompt}
96
  ],
97
  "temperature": 0.25,
98
- "max_tokens": 1200 # Slightly optimized to prevent hitting the RPM limit instantly
99
  }
100
 
101
  try:
@@ -103,7 +103,7 @@ def practical_simulation_engine(pressure, temp, moisture):
103
  if res.status_code == 200:
104
  return res.json()['choices'][0]['message']['content']
105
  elif res.status_code == 429:
106
- return "⏳ **Groq API Rate Limit Hit (429)**: The response is very detailed. Please wait 8-10 seconds and click transmit again, or switch models."
107
  else:
108
  return f"❌ Groq API Communication Failure ({res.status_code}): {res.text}"
109
  except Exception as e:
 
6
  # 1. CLOUD SETTINGS & SECURITY INITIALIZATION
7
  # ==========================================
8
  GROQ_API_KEY = os.environ.get("GROQ_API_KEY")
9
+ # Switched to the latest active high-tier production model on Groq
10
+ LLM_MODEL = "llama-3.3-70b-versatile"
11
 
12
  # ==========================================
13
  # 2. EXTENSIVE DATA TEMPLATE (Deep Research Source)
 
95
  {"role": "user", "content": user_prompt}
96
  ],
97
  "temperature": 0.25,
98
+ "max_tokens": 1200
99
  }
100
 
101
  try:
 
103
  if res.status_code == 200:
104
  return res.json()['choices'][0]['message']['content']
105
  elif res.status_code == 429:
106
+ return "⏳ **Groq API Rate Limit Hit (429)**: Please wait 5-8 seconds and click transmit again to refresh the token window."
107
  else:
108
  return f"❌ Groq API Communication Failure ({res.status_code}): {res.text}"
109
  except Exception as e: