blazingbunny commited on
Commit
344bdb1
·
1 Parent(s): 96bd6ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -1,14 +1,17 @@
1
  import streamlit as st
 
2
  from google.cloud import language_v1
3
  import json
4
- from google.oauth2 import service_account
5
  import os
6
- from google.oauth2 import service_account
7
- from google.cloud import language_v1
8
 
9
  def sample_analyze_entities(text_content):
10
- # Read the JSON credentials from st.secrets
11
- service_account_info = json.loads(st.secrets["google_nlp"]["credentials"])
 
 
 
 
12
 
13
  # Create credentials
14
  credentials = service_account.Credentials.from_service_account_info(
 
1
  import streamlit as st
2
+ from google.oauth2 import service_account
3
  from google.cloud import language_v1
4
  import json
 
5
  import os
6
+
 
7
 
8
  def sample_analyze_entities(text_content):
9
+ # Directly read the JSON credentials from st.secrets
10
+ service_account_info = st.secrets["google_nlp"]["credentials"]
11
+
12
+ # If the credentials are already in dict form, no need to load from JSON
13
+ if not isinstance(service_account_info, dict):
14
+ service_account_info = json.loads(service_account_info)
15
 
16
  # Create credentials
17
  credentials = service_account.Credentials.from_service_account_info(