noddysnots commited on
Commit
bf4a0ea
·
verified ·
1 Parent(s): 2efbb9e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -6
app.py CHANGED
@@ -1,29 +1,34 @@
1
  import gradio as gr
2
  import gspread
3
  import os
4
- from oauth2client.service_account import ServiceAccountCredentials
5
- from transformers import pipeline
6
  from twilio.rest import Client
7
 
8
- # Authenticate with Google Sheets
9
  scope = [
10
  "https://www.googleapis.com/auth/spreadsheets",
11
  "https://www.googleapis.com/auth/drive"
12
  ]
13
 
14
- creds_dict = {
 
 
15
  "type": "service_account",
16
  "project_id": "varahaa-farmers",
17
  "private_key_id": "f48da20518b3a08df328b6d07006b35472445e5b",
18
- "private_key": os.environ["PRIVATE_KEY"].replace('\\n', '\n'),
19
  "client_email": "[email protected]",
20
  "client_id": "113471167964788057428",
21
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
22
  "token_uri": "https://oauth2.googleapis.com/token",
23
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
24
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/huggingface-bot%40varahaa-farmers.iam.gserviceaccount.com"
25
- }
 
 
 
26
 
 
27
  creds = ServiceAccountCredentials.from_json_keyfile_dict(creds_dict, scope)
28
  client = gspread.authorize(creds)
29
  sheet = client.open("Varahaa Farmer Verification").sheet1
 
1
  import gradio as gr
2
  import gspread
3
  import os
4
+ from google.oauth2 import service_account
 
5
  from twilio.rest import Client
6
 
7
+ # Google Sheets Setup
8
  scope = [
9
  "https://www.googleapis.com/auth/spreadsheets",
10
  "https://www.googleapis.com/auth/drive"
11
  ]
12
 
13
+ private_key = os.environ["PRIVATE_KEY"].replace('\\n', '\n')
14
+
15
+ credentials = service_account.Credentials.from_service_account_info({
16
  "type": "service_account",
17
  "project_id": "varahaa-farmers",
18
  "private_key_id": "f48da20518b3a08df328b6d07006b35472445e5b",
19
+ "private_key": private_key,
20
  "client_email": "[email protected]",
21
  "client_id": "113471167964788057428",
22
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
23
  "token_uri": "https://oauth2.googleapis.com/token",
24
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
25
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/huggingface-bot%40varahaa-farmers.iam.gserviceaccount.com"
26
+ }, scopes=scope)
27
+
28
+ gc = gspread.authorize(credentials)
29
+ sheet = gc.open("Varahaa Farmer Verification").sheet1
30
 
31
+ # Rest of your Twilio and Gradio code...
32
  creds = ServiceAccountCredentials.from_json_keyfile_dict(creds_dict, scope)
33
  client = gspread.authorize(creds)
34
  sheet = client.open("Varahaa Farmer Verification").sheet1