Spaces:
Runtime error
Runtime error
adding secrets
Browse files- pag/monitor.py +6 -2
pag/monitor.py
CHANGED
|
@@ -16,6 +16,7 @@ import pandas as pd
|
|
| 16 |
import grpc
|
| 17 |
import pb.timesfm_pb2_grpc
|
| 18 |
import pb.timesfm_pb2
|
|
|
|
| 19 |
import time
|
| 20 |
|
| 21 |
def check_authentication():
|
|
@@ -29,6 +30,8 @@ config.instance_id = '352670fb-2edf-4abd-90c8-437485a2403e'
|
|
| 29 |
config.sh_client_id = 'ca95f10f-443c-4c60-9a36-98950292bb9b'
|
| 30 |
config.sh_client_secret = 'rNFGRxGNiNFrXJfGyHIkVRyGOrdWNsfI'
|
| 31 |
config.sh_timesfm_IP = "34.121.141.161"
|
|
|
|
|
|
|
| 32 |
|
| 33 |
def select_field(gdf):
|
| 34 |
st.markdown("""
|
|
@@ -303,15 +306,16 @@ def monitor_fields():
|
|
| 303 |
|
| 304 |
if field_name != "Select Field":
|
| 305 |
st.title(":orange[Predict Metrics for Next Month]")
|
|
|
|
| 306 |
subcol1, subcol2, subcol3 = st.columns(3)
|
| 307 |
-
if subcol2.button(f'Predict
|
| 308 |
start_date = '2024-01-01'
|
| 309 |
today = datetime.today()
|
| 310 |
end_date = today.strftime('%Y-%m-%d')
|
| 311 |
year = '2024'
|
| 312 |
|
| 313 |
dates = get_and_cache_available_dates(gdf, field_name, year, start_date, end_date)
|
| 314 |
-
my_bar = st.progress(0, text= f"Downloading Data for the last {len(dates)//
|
| 315 |
counter = 0
|
| 316 |
downloaded_prev_metrics = []
|
| 317 |
for index, date in enumerate(dates):
|
|
|
|
| 16 |
import grpc
|
| 17 |
import pb.timesfm_pb2_grpc
|
| 18 |
import pb.timesfm_pb2
|
| 19 |
+
import openAI
|
| 20 |
import time
|
| 21 |
|
| 22 |
def check_authentication():
|
|
|
|
| 30 |
config.sh_client_id = 'ca95f10f-443c-4c60-9a36-98950292bb9b'
|
| 31 |
config.sh_client_secret = 'rNFGRxGNiNFrXJfGyHIkVRyGOrdWNsfI'
|
| 32 |
config.sh_timesfm_IP = "34.121.141.161"
|
| 33 |
+
client = OpenAI(api_key= os.environ['OPENAI_KEY'])
|
| 34 |
+
print(os.environ)
|
| 35 |
|
| 36 |
def select_field(gdf):
|
| 37 |
st.markdown("""
|
|
|
|
| 306 |
|
| 307 |
if field_name != "Select Field":
|
| 308 |
st.title(":orange[Predict Metrics for Next Month]")
|
| 309 |
+
st.write(f"Press the button below to predict {metric} for the next 10 weeks")
|
| 310 |
subcol1, subcol2, subcol3 = st.columns(3)
|
| 311 |
+
if subcol2.button(f'Predict & Recommend'):
|
| 312 |
start_date = '2024-01-01'
|
| 313 |
today = datetime.today()
|
| 314 |
end_date = today.strftime('%Y-%m-%d')
|
| 315 |
year = '2024'
|
| 316 |
|
| 317 |
dates = get_and_cache_available_dates(gdf, field_name, year, start_date, end_date)
|
| 318 |
+
my_bar = st.progress(0, text= f"Downloading Data for the last {len(dates)//6} months ...")
|
| 319 |
counter = 0
|
| 320 |
downloaded_prev_metrics = []
|
| 321 |
for index, date in enumerate(dates):
|