Update app.py
Browse files
app.py
CHANGED
@@ -1,18 +1,17 @@
|
|
1 |
import os
|
2 |
-
import
|
3 |
-
from firebase_admin import credentials
|
4 |
-
from transformers import pipeline
|
5 |
-
import gradio as gr
|
6 |
|
7 |
-
#
|
8 |
-
|
9 |
-
|
10 |
-
#
|
11 |
-
|
12 |
-
|
13 |
|
14 |
-
|
15 |
-
|
|
|
16 |
|
17 |
# ----------------------------------
|
18 |
# Initialize Hugging Face RAG Model
|
|
|
1 |
import os
|
2 |
+
import json
|
3 |
+
from firebase_admin import credentials
|
|
|
|
|
4 |
|
5 |
+
# Fetch the Firebase credentials from the Hugging Face secret
|
6 |
+
firebase_credential = os.getenv("FIREBASE_CREDENTIALS")
|
7 |
+
|
8 |
+
# Save the credentials to a temporary file
|
9 |
+
with open("serviceAccountKey.json", "w") as f:
|
10 |
+
f.write(firebase_credential)
|
11 |
|
12 |
+
# Initialize Firebase Admin SDK
|
13 |
+
cred = credentials.Certificate("serviceAccountKey.json")
|
14 |
+
firebase_admin.initialize_app(cred, {"databaseURL": "https://your-database-name.firebaseio.com/"})
|
15 |
|
16 |
# ----------------------------------
|
17 |
# Initialize Hugging Face RAG Model
|