Nakhwa commited on
Commit
38d5029
1 Parent(s): 75cfb71

Update deteksi_upload.py

Browse files
Files changed (1) hide show
  1. deteksi_upload.py +9 -7
deteksi_upload.py CHANGED
@@ -8,9 +8,10 @@ from google.cloud import storage
8
  from io import StringIO
9
  import os
10
  from datetime import datetime
 
11
 
12
  # Set environment variable for Google Cloud credentials
13
- os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "inbound-source-431806-g7-e49e388ce0be.json"
14
 
15
  def save_corrections_to_gcs(bucket_name, file_name, correction_data):
16
  client = storage.Client()
@@ -135,13 +136,12 @@ def show_deteksi_upload():
135
  )
136
 
137
  # Add Timestamp only for saving
138
- corrected_df['Timestamp'] = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
139
-
140
- cols = ['Result_Detection', 'Result_Correction'] + \
141
- [col for col in corrected_df.columns if col not in ['Result_Detection', 'Result_Correction']]
142
 
 
143
  corrected_df_to_display = corrected_df[cols]
144
-
145
  st.markdown("<h6 style='font-size: 16px; margin-bottom: 0;'>Data yang Dikoreksi</h6>", unsafe_allow_html=True)
146
  st.dataframe(corrected_df_to_display, use_container_width=True, hide_index=True)
147
  else:
@@ -150,7 +150,9 @@ def show_deteksi_upload():
150
  if st.button("Simpan", key="corrected_data"):
151
  if 'df' in st.session_state:
152
  corrected_df = st.session_state.df[st.session_state.df['Correction']].copy()
153
- corrected_df['Timestamp'] = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
 
 
154
  corrected_df = corrected_df.drop(columns=['Correction'])
155
 
156
  if not corrected_df.empty:
 
8
  from io import StringIO
9
  import os
10
  from datetime import datetime
11
+ import pytz
12
 
13
  # Set environment variable for Google Cloud credentials
14
+ os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = r"C:\Users\Lenovo\Downloads\DasboardBert\inbound-source-431806-g7-e49e388ce0be.json"
15
 
16
  def save_corrections_to_gcs(bucket_name, file_name, correction_data):
17
  client = storage.Client()
 
136
  )
137
 
138
  # Add Timestamp only for saving
139
+ wib = pytz.timezone('Asia/Jakarta')
140
+ corrected_df['Timestamp'] = datetime.now(wib).strftime('%Y-%m-%d %H:%M:%S')
 
 
141
 
142
+ cols = ['Timestamp', 'Result_Correction', 'Result_Detection', 'Label_id', 'Label', 'Title', 'Content', 'Fact', 'References', 'Classification', 'Datasource']
143
  corrected_df_to_display = corrected_df[cols]
144
+
145
  st.markdown("<h6 style='font-size: 16px; margin-bottom: 0;'>Data yang Dikoreksi</h6>", unsafe_allow_html=True)
146
  st.dataframe(corrected_df_to_display, use_container_width=True, hide_index=True)
147
  else:
 
150
  if st.button("Simpan", key="corrected_data"):
151
  if 'df' in st.session_state:
152
  corrected_df = st.session_state.df[st.session_state.df['Correction']].copy()
153
+
154
+ wib = pytz.timezone('Asia/Jakarta')
155
+ corrected_df['Timestamp'] = datetime.now(wib).strftime('%Y-%m-%d %H:%M:%S')
156
  corrected_df = corrected_df.drop(columns=['Correction'])
157
 
158
  if not corrected_df.empty: