amoldwalunj commited on
Commit
e6ec063
·
1 Parent(s): b1db9a8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -4
app.py CHANGED
@@ -7,6 +7,7 @@ import pandas as pd
7
  import os
8
  import openai
9
  import time
 
10
 
11
  os.environ["api_key"] == st.secrets["api_key"]
12
 
@@ -19,6 +20,11 @@ print(type(os.environ["GSPREAD_CREDENTIALS"]))
19
 
20
  print(st.secrets["GSPREAD_CREDENTIALS"], "GSPREAD_CREDENTIALS")
21
 
 
 
 
 
 
22
  # Initialize session state
23
  if 'df_final_output' not in st.session_state:
24
  st.session_state['df_final_output'] = None
@@ -48,7 +54,9 @@ if page == 'Review Analysis':
48
  #st.title('Customer Reviews Analysis')
49
 
50
  # Authenticate Google Sheets API
51
- gc = gspread.service_account(filename='arctic-rite-381810-e8bee8664772.json')
 
 
52
 
53
  # Ask user for Google Sheet URL
54
  sheet_url = st.text_input('Enter the URL of your Google Sheet')
@@ -257,7 +265,9 @@ if page == 'Feature Benefits':
257
  st.title('Feature Benefits Page')
258
 
259
  # Authenticate Google Sheets API
260
- gc = gspread.service_account(filename='arctic-rite-381810-e8bee8664772.json')
 
 
261
 
262
  # Ask user for Google Sheet URL
263
  sheet_url = st.text_input('Enter the URL of your Google Sheet')
@@ -456,7 +466,9 @@ if page == 'Identify Avatars':
456
  st.title('Identify Avatars Page')
457
 
458
  # Authenticate Google Sheets API
459
- gc = gspread.service_account(filename='arctic-rite-381810-e8bee8664772.json')
 
 
460
 
461
 
462
 
@@ -721,7 +733,9 @@ if page == 'Tone of Voice Manual':
721
  st.title('Tone of Voice Manual Page')
722
 
723
  # Authenticate Google Sheets API
724
- gc = gspread.service_account(filename='arctic-rite-381810-e8bee8664772.json')
 
 
725
 
726
  # Ask user for Google Sheet URL
727
  sheet_url = st.text_input('Enter the URL of your Google Sheet')
 
7
  import os
8
  import openai
9
  import time
10
+ import json
11
 
12
  os.environ["api_key"] == st.secrets["api_key"]
13
 
 
20
 
21
  print(st.secrets["GSPREAD_CREDENTIALS"], "GSPREAD_CREDENTIALS")
22
 
23
+ json_credentials= st.secrets["GSPREAD_CREDENTIALS"]
24
+
25
+ # Parse the JSON content (string) into a Python dictionary
26
+ credentials_dict = json.loads(json_credentials)
27
+
28
  # Initialize session state
29
  if 'df_final_output' not in st.session_state:
30
  st.session_state['df_final_output'] = None
 
54
  #st.title('Customer Reviews Analysis')
55
 
56
  # Authenticate Google Sheets API
57
+ #gc = gspread.service_account(filename='arctic-rite-381810-e8bee8664772.json')
58
+ # Authenticate Google Sheets API using the dictionary
59
+ gc = gspread.service_account_info(credentials_dict)
60
 
61
  # Ask user for Google Sheet URL
62
  sheet_url = st.text_input('Enter the URL of your Google Sheet')
 
265
  st.title('Feature Benefits Page')
266
 
267
  # Authenticate Google Sheets API
268
+ #gc = gspread.service_account(filename='arctic-rite-381810-e8bee8664772.json')
269
+
270
+ gc = gspread.service_account_info(credentials_dict)
271
 
272
  # Ask user for Google Sheet URL
273
  sheet_url = st.text_input('Enter the URL of your Google Sheet')
 
466
  st.title('Identify Avatars Page')
467
 
468
  # Authenticate Google Sheets API
469
+ # gc = gspread.service_account(filename='arctic-rite-381810-e8bee8664772.json')
470
+
471
+ gc = gspread.service_account_info(credentials_dict)
472
 
473
 
474
 
 
733
  st.title('Tone of Voice Manual Page')
734
 
735
  # Authenticate Google Sheets API
736
+ #gc = gspread.service_account(filename='arctic-rite-381810-e8bee8664772.json')
737
+
738
+ gc = gspread.service_account_info(credentials_dict)
739
 
740
  # Ask user for Google Sheet URL
741
  sheet_url = st.text_input('Enter the URL of your Google Sheet')