Spaces:
Running
Running
leandroaraujodev
commited on
Commit
•
8e455f8
1
Parent(s):
6065097
Update app.py
Browse files
app.py
CHANGED
@@ -175,8 +175,18 @@ def clean_documents(documents):
|
|
175 |
return cleaned_documents
|
176 |
|
177 |
from llama_index.readers.google import GoogleDriveReader
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
|
179 |
-
credentials_path = "path_to_credentials.json" # Ajuste o caminho para seu arquivo de credenciais
|
180 |
google_drive_reader = GoogleDriveReader(credentials_path=credentials_path)
|
181 |
google_drive_reader._creds = google_drive_reader._get_credentials()
|
182 |
|
|
|
175 |
return cleaned_documents
|
176 |
|
177 |
from llama_index.readers.google import GoogleDriveReader
|
178 |
+
import json
|
179 |
+
|
180 |
+
credentials_json = os.getenv('GOOGLE_CREDENTIALS')
|
181 |
+
|
182 |
+
if credentials_json is None:
|
183 |
+
raise ValueError("The GOOGLE_CREDENTIALS environment variable is not set.")
|
184 |
+
|
185 |
+
# Write the credentials to a file
|
186 |
+
credentials_path = "credentials.json"
|
187 |
+
with open(credentials_path, 'w') as credentials_file:
|
188 |
+
credentials_file.write(credentials_json)
|
189 |
|
|
|
190 |
google_drive_reader = GoogleDriveReader(credentials_path=credentials_path)
|
191 |
google_drive_reader._creds = google_drive_reader._get_credentials()
|
192 |
|