GVAmaresh commited on
Commit
98ce4e4
·
1 Parent(s): ee321f9

dev: check working

Browse files
Files changed (2) hide show
  1. app.py +31 -0
  2. requirements.txt +3 -0
app.py CHANGED
@@ -32,3 +32,34 @@ def reencode_audio(input_path, output_path):
32
 
33
 
34
  #-----------------------------------------------------------------------------------------
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
 
34
  #-----------------------------------------------------------------------------------------
35
+
36
+ import os
37
+ from dotenv import load_dotenv
38
+ from googleapiclient.discovery import build
39
+ from google.auth.transport.requests import Request
40
+ from google.oauth2.credentials import Credentials
41
+ from google.oauth2 import service_account
42
+
43
+ SCOPES = ['https://www.googleapis.com/auth/drive']
44
+
45
+
46
+ details = {
47
+ "refresh_token": "1//0gYLCF5OE4fTmCgYIARAAGBASNwF-L9Irp3Ik0q5OtsQClcLwW7sxPZSuMboe7wyjteuSuOD_WvavEHfhuTvkSjkLHitkh76XaD4",
48
+ "token": "ya29.a0ARW5m753vyDgN_C7kUnnYTkeCfknSnDDj8tuVCe99dL2ieN3IzvCPVoN5kVg49CAYDz-pS5AgpjH7whiy7dr7QhwX4EiGQreJCzu109nlH6kxultrNup5q-_W2dNepbOa5YV8iH7OwP28RjQVR7fs9IlMO7BfnA9hw-WQqXNaCgYKAXMSARMSFQHGX2MieHrC7CpySZFYpoZWln6vxA0175",
49
+ "token_uri": "https://oauth2.googleapis.com/token",
50
+ "client_id": "573421158717-a2tulr4s7gg6or7sd76336busnmk22vu.apps.googleusercontent.com",
51
+ "client_secret": "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",
52
+ "scopes": ["https://www.googleapis.com/auth/drive"],
53
+ "universe_domain": "googleapis.com",
54
+ "account": "",
55
+ }
56
+
57
+
58
+ def authenticate_with_env_vars(details):
59
+ creds = Credentials.from_authorized_user_info(details, SCOPES)
60
+ if not creds or not creds.valid:
61
+ if creds and creds.expired and creds.refresh_token:
62
+ creds.refresh(Request())
63
+ else:
64
+ raise ValueError("Credentials are invalid and cannot be refreshed.")
65
+ return creds
requirements.txt CHANGED
@@ -16,5 +16,8 @@ soundfile
16
  python-multipart
17
  matplotlib
18
  numpy
 
 
 
19
  gdown
20
  requests
 
16
  python-multipart
17
  matplotlib
18
  numpy
19
+ google-api-python-client
20
+ google-auth-httplib2
21
+ google-auth-oauthlib
22
  gdown
23
  requests