Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,10 +13,14 @@ from dotenv import load_dotenv
|
|
| 13 |
import uuid
|
| 14 |
|
| 15 |
|
| 16 |
-
# Google Books API setup
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
|
| 22 |
|
|
|
|
| 13 |
import uuid
|
| 14 |
|
| 15 |
|
| 16 |
+
# Google Books API setup with Service Account
|
| 17 |
+
json_key_path: str = "/app/audiobookagent-aaf910cd6329.json" # Adjust path for Hugging Face Spaces
|
| 18 |
+
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = json_key_path
|
| 19 |
+
credentials = service_account.Credentials.from_service_account_file(
|
| 20 |
+
json_key_path,
|
| 21 |
+
scopes=["https://www.googleapis.com/auth/books"]
|
| 22 |
+
)
|
| 23 |
+
books_service = build("books", "v1", credentials=credentials)
|
| 24 |
|
| 25 |
|
| 26 |
|