Spaces:
Running
Running
Update deteksi_content.py
Browse files- deteksi_content.py +4 -2
deteksi_content.py
CHANGED
|
@@ -10,9 +10,10 @@ from styles import COMMON_CSS
|
|
| 10 |
from google.cloud import storage
|
| 11 |
import os
|
| 12 |
from io import StringIO
|
|
|
|
| 13 |
|
| 14 |
# Set environment variable for Google Cloud credentials
|
| 15 |
-
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "inbound-source-431806-g7-e49e388ce0be.json"
|
| 16 |
|
| 17 |
def save_corrections_to_gcs(bucket_name, file_name, correction_data):
|
| 18 |
client = storage.Client() # Uses the credentials set by the environment variable
|
|
@@ -120,13 +121,14 @@ def show_deteksi_konten():
|
|
| 120 |
# Determine the correction based on the prediction
|
| 121 |
st.session_state.correction = "HOAX" if st.session_state.detection_result == "NON-HOAX" else "NON-HOAX"
|
| 122 |
|
|
|
|
| 123 |
# Display the correction DataFrame
|
| 124 |
correction_data = [{
|
| 125 |
'Title': st.session_state.headline,
|
| 126 |
'Content': st.session_state.content,
|
| 127 |
'Prediction': st.session_state.detection_result,
|
| 128 |
'Correction': st.session_state.correction,
|
| 129 |
-
'Timestamp': datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
| 130 |
}]
|
| 131 |
|
| 132 |
# Save button
|
|
|
|
| 10 |
from google.cloud import storage
|
| 11 |
import os
|
| 12 |
from io import StringIO
|
| 13 |
+
import pytz
|
| 14 |
|
| 15 |
# Set environment variable for Google Cloud credentials
|
| 16 |
+
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = r"C:\Users\Lenovo\Downloads\DasboardBert\inbound-source-431806-g7-e49e388ce0be.json"
|
| 17 |
|
| 18 |
def save_corrections_to_gcs(bucket_name, file_name, correction_data):
|
| 19 |
client = storage.Client() # Uses the credentials set by the environment variable
|
|
|
|
| 121 |
# Determine the correction based on the prediction
|
| 122 |
st.session_state.correction = "HOAX" if st.session_state.detection_result == "NON-HOAX" else "NON-HOAX"
|
| 123 |
|
| 124 |
+
wib = pytz.timezone('Asia/Jakarta')
|
| 125 |
# Display the correction DataFrame
|
| 126 |
correction_data = [{
|
| 127 |
'Title': st.session_state.headline,
|
| 128 |
'Content': st.session_state.content,
|
| 129 |
'Prediction': st.session_state.detection_result,
|
| 130 |
'Correction': st.session_state.correction,
|
| 131 |
+
'Timestamp': datetime.now(wib).strftime("%Y-%m-%d %H:%M:%S")
|
| 132 |
}]
|
| 133 |
|
| 134 |
# Save button
|