Update app.py
Browse files
app.py
CHANGED
|
@@ -20,6 +20,26 @@ PAYLOAD = {
|
|
| 20 |
"stock_card_report_id": "d2f1a0e1-7be1-472c-9610-94287154e544"
|
| 21 |
}
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
def fetch_data():
|
| 24 |
"""Fetch stock card report data from API and return cleaned DataFrame"""
|
| 25 |
response = requests.post(API_URL, data=PAYLOAD)
|
|
|
|
| 20 |
"stock_card_report_id": "d2f1a0e1-7be1-472c-9610-94287154e544"
|
| 21 |
}
|
| 22 |
|
| 23 |
+
|
| 24 |
+
# Configure Gemini API
|
| 25 |
+
gemini_api_key = os.environ.get('GOOGLE_API_KEY')
|
| 26 |
+
if not gemini_api_key:
|
| 27 |
+
st.error("GOOGLE_API_KEY environment variable not set.")
|
| 28 |
+
st.stop()
|
| 29 |
+
|
| 30 |
+
genai.configure(api_key=gemini_api_key)
|
| 31 |
+
|
| 32 |
+
generation_config = {
|
| 33 |
+
"temperature": 0.2,
|
| 34 |
+
"top_p": 0.95,
|
| 35 |
+
"max_output_tokens": 5000,
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
model = genai.GenerativeModel(
|
| 39 |
+
model_name="gemini-2.0-flash-thinking-exp",
|
| 40 |
+
generation_config=generation_config,
|
| 41 |
+
)
|
| 42 |
+
|
| 43 |
def fetch_data():
|
| 44 |
"""Fetch stock card report data from API and return cleaned DataFrame"""
|
| 45 |
response = requests.post(API_URL, data=PAYLOAD)
|