blazingbunny commited on
Commit
f2bf6ab
·
1 Parent(s): 1148c58

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -20,8 +20,13 @@ st.title("Google Cloud NLP Text Classifier")
20
  st.write("This tool classifies text into predefined categories.")
21
 
22
  def sample_classify_text(text_content):
23
- # Assuming service_account_info is set in your Streamlit secrets
24
- service_account_info = json.loads(st.secrets["google_nlp"])
 
 
 
 
 
25
  credentials = service_account.Credentials.from_service_account_info(
26
  service_account_info, scopes=["https://www.googleapis.com/auth/cloud-platform"]
27
  )
 
20
  st.write("This tool classifies text into predefined categories.")
21
 
22
  def sample_classify_text(text_content):
23
+ try:
24
+ # Assuming service_account_info is set in your Streamlit secrets
25
+ service_account_info = json.loads(st.secrets["google_nlp"])
26
+ except json.JSONDecodeError:
27
+ st.error("Invalid or empty JSON in 'google_nlp' secret.")
28
+ return
29
+
30
  credentials = service_account.Credentials.from_service_account_info(
31
  service_account_info, scopes=["https://www.googleapis.com/auth/cloud-platform"]
32
  )