Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -20,20 +20,20 @@ from firebase_admin import credentials, db
|
|
20 |
from google.cloud import storage
|
21 |
|
22 |
# Update the path below to your Firebase service account key JSON file
|
23 |
-
SERVICE_ACCOUNT_KEY = "serviceAccountKey.json" # <--
|
24 |
|
25 |
# Initialize Firebase Admin for Realtime Database
|
26 |
cred = credentials.Certificate(SERVICE_ACCOUNT_KEY)
|
27 |
firebase_admin.initialize_app(cred, {
|
28 |
-
'databaseURL': 'https://sentiment-analysis-7562e-default-rtdb.firebaseio.com/' # <--
|
29 |
})
|
30 |
|
31 |
def upload_file_to_firebase(file_path, destination_blob_name):
|
32 |
"""
|
33 |
Uploads a file to Firebase Storage and returns its public URL.
|
34 |
"""
|
35 |
-
# Update bucket name (usually: your-project-id.appspot.com)
|
36 |
-
bucket_name = "your-project-id.appspot.com" # <--
|
37 |
storage_client = storage.Client.from_service_account_json(SERVICE_ACCOUNT_KEY)
|
38 |
bucket = storage_client.bucket(bucket_name)
|
39 |
blob = bucket.blob(destination_blob_name)
|
|
|
20 |
from google.cloud import storage
|
21 |
|
22 |
# Update the path below to your Firebase service account key JSON file
|
23 |
+
SERVICE_ACCOUNT_KEY = "serviceAccountKey.json" # <-- Ensure this file exists in your project directory
|
24 |
|
25 |
# Initialize Firebase Admin for Realtime Database
|
26 |
cred = credentials.Certificate(SERVICE_ACCOUNT_KEY)
|
27 |
firebase_admin.initialize_app(cred, {
|
28 |
+
'databaseURL': 'https://sentiment-analysis-7562e-default-rtdb.firebaseio.com/' # <-- Update with your actual DB URL
|
29 |
})
|
30 |
|
31 |
def upload_file_to_firebase(file_path, destination_blob_name):
|
32 |
"""
|
33 |
Uploads a file to Firebase Storage and returns its public URL.
|
34 |
"""
|
35 |
+
# Update the bucket name to match your Firebase Storage bucket (usually: your-project-id.appspot.com)
|
36 |
+
bucket_name = "your-project-id.appspot.com" # <-- Update with your storage bucket name
|
37 |
storage_client = storage.Client.from_service_account_json(SERVICE_ACCOUNT_KEY)
|
38 |
bucket = storage_client.bucket(bucket_name)
|
39 |
blob = bucket.blob(destination_blob_name)
|