curiousgeorge1292 commited on
Commit
01e805b
·
verified ·
1 Parent(s): ee15c04

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -3,6 +3,7 @@ import requests
3
  from bs4 import BeautifulSoup
4
  import gradio as gr
5
  from groq import Groq
 
6
  from googleapiclient.discovery import build
7
  from google.oauth2.service_account import Credentials
8
 
@@ -14,7 +15,10 @@ SCOPES = ['https://www.googleapis.com/auth/spreadsheets']
14
  SERVICE_ACCOUNT_FILE = os.environ.get("MY_SERVICE_ACCOUNT_JSON")
15
  SPREADSHEET_ID = os.environ.get("GOOGLE_SHEET_ID")
16
 
17
- credentials = Credentials.from_service_account_info(SERVICE_ACCOUNT_FILE, scopes=SCOPES)
 
 
 
18
  service = build('sheets', 'v4', credentials=credentials)
19
  sheet = service.spreadsheets()
20
 
 
3
  from bs4 import BeautifulSoup
4
  import gradio as gr
5
  from groq import Groq
6
+ import json
7
  from googleapiclient.discovery import build
8
  from google.oauth2.service_account import Credentials
9
 
 
15
  SERVICE_ACCOUNT_FILE = os.environ.get("MY_SERVICE_ACCOUNT_JSON")
16
  SPREADSHEET_ID = os.environ.get("GOOGLE_SHEET_ID")
17
 
18
+ service_account_info = json.loads(MY_SERVICE_ACCOUNT_JSON)
19
+ credentials = Credentials.from_service_account_info(
20
+ service_account_info, scopes=SCOPES
21
+ )
22
  service = build('sheets', 'v4', credentials=credentials)
23
  sheet = service.spreadsheets()
24