Spaces:
Sleeping
Sleeping
Jainam Jain
commited on
Commit
•
58c9975
1
Parent(s):
25d75f1
Updated
Browse files- .env +23 -18
- app.py +17 -24
- requirements.txt +1 -2
.env
CHANGED
@@ -1,18 +1,23 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Firebase Configuration
|
2 |
+
FIREBASE_API_KEY=AIzaSyClnRJAnrJgAgkYjuYnlvu-CJ6Cxyklebo
|
3 |
+
FIREBASE_AUTH_DOMAIN=socioverse-2025.firebaseapp.com
|
4 |
+
FIREBASE_PROJECT_ID=socioverse-2025
|
5 |
+
FIREBASE_STORAGE_BUCKET=socioverse-2025.appspot.com
|
6 |
+
FIREBASE_MESSAGING_SENDER_ID=689574504641
|
7 |
+
FIREBASE_APP_ID=1:689574504641:web:a22f6a2fa343e4221acc40
|
8 |
+
FIREBASE_DATABASE_URL=https://console.firebase.google.com/project/socioverse-2025/storage/socioverse-2025.appspot.com/files
|
9 |
+
|
10 |
+
# Service Account Details
|
11 |
+
FIREBASE_SERVICE_ACCOUNT_JSON='''{
|
12 |
+
"type": "service_account",
|
13 |
+
"project_id": "socioverse-2025",
|
14 |
+
"private_key_id": "dde07d7cbca92e48903b77629995db2517ae90b7",
|
15 |
+
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDHti0sOlSFb9cY\n5A4o29ARzEsahhxtlSW29NtaZiWztZZ0WUmkvOPc3BDhV6LdwELXrT61rkXyA+YY\nzVxSZ9y/zMx9uH1iZKo7LsT/Y60xvuZlmWzBArrYVgrcYgNZZP27YLwDGj6G1GXI\npQfMeWlTfmfWbfM0q0kbOAWrCYhI7TL4+vPGvtU8rpFr+EZgeri88V7BxMW5J8mO\n9Hb4Hwy7pvSCczmLDTOY/SSn5eR/nxMReJBbi6dpH1kZESgpqNfoUrfdanD8Oe5W\nYXDSCQzZmFWWqRzmn9Qyl2uBWnKBOxB02KIrYdhuPa+9tHPxirteanRXeZYPit9B\nlSv4UD4rAgMBAAECggEAUyI5waxyXK2Gu5zLbCS8g3woU106Xj902Kkq2oGk9h8E\nB2DXsBTVQa319Of3KxoKeR9r+FMYWLtYwEBUSxVjJhBJm5f90cSXvFUmui0y/n86\nB1cLl3jccIu4r665ODA7ExIckaoOFzA5QoG4MlzkBFadQPy5/dXDc+opKd6o9bnS\ngX3eHtMN8uNFt7hLTWvwcJW4NAd/NspxbqCeTZWYw5JMj2ZUlJcWBBQ/dXWY9zv0\nTI0CSBqQSaNwtkBKFj7qcmJloMlW+N00ywrOI3avxnk2LFLkB6XCWY/T4bL06yLf\nai+ZZ8CoIIPLoovTOlJVOA+Qu+McuU4OelzBUW2y0QKBgQD6WCFVQ/1eDgnPoaN9\nLclpexdWnhANuYDyP3TM5HIAPqQNgjZCTnm8gP8i6WSVGqTSh4fk6lAGEoSIbRwj\nV5HFYPayxkjSXqb/ySfK7awAHdAc+jskw6JlkQd4XzStLN9H5HlpZTMqm6QxL3vx\nP5ZmCquRU7WYEbmDBQbXoZkHKQKBgDNI2KpHrNA/7zeolXXY\nADu0kH+ytW4kxDuS1Lq90Nhuf5CXzRMA4pzozlJvqeOv+gj4uqX/DxLZaQ2p3Fqo\noKVJBrI63mxzu6Wambj9E6CdYelov+Ekb5X8IKFp2ntfaNPYNQGXdqbgqE10AVLS\n5Gbrgxn2+88Z4YDgCNl9ay9O\n-----END PRIVATE KEY-----\n",
|
16 |
+
"client_email": "firebase-adminsdk-gcc6m@socioverse-2025.iam.gserviceaccount.com",
|
17 |
+
"client_id": "107273420733077415353",
|
18 |
+
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
19 |
+
"token_uri": "https://oauth2.googleapis.com/token",
|
20 |
+
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
|
21 |
+
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-gcc6m%40socioverse-2025.iam.gserviceaccount.com",
|
22 |
+
"universe_domain": "googleapis.com"
|
23 |
+
}'''
|
app.py
CHANGED
@@ -4,39 +4,32 @@ import urllib
|
|
4 |
from retinaface import RetinaFace
|
5 |
from deepface import DeepFace
|
6 |
from fastapi import FastAPI
|
7 |
-
import
|
8 |
-
from
|
|
|
|
|
9 |
app = FastAPI()
|
10 |
-
|
11 |
@app.get("/")
|
12 |
def read_root():
|
13 |
return {"Hello": "World"}
|
14 |
|
15 |
@app.get("/verify/")
|
16 |
def verify_image(url1):
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
"type": os.getenv("type_KEY"),
|
27 |
-
"project_id": os.getenv("project_id_KEY"),
|
28 |
-
"private_key_id": os.getenv("private_key_id_KEY"),
|
29 |
-
"private_key": os.getenv("private_key_KEY"),
|
30 |
-
"client_email": os.getenv("client_email_KEY"),
|
31 |
-
"client_id":os.getenv("client_id_KEY"),
|
32 |
-
"auth_uri": os.getenv("auth_uri_KEY"),
|
33 |
-
"token_uri": os.getenv("token_uri_KEY"),
|
34 |
-
"auth_provider_x509_cert_url": os.getenv("auth_provider_x509_cert_url_KEY"),
|
35 |
-
"client_x509_cert_url": os.getenv("client_x509_cert_url_KEY"),
|
36 |
-
"universe_domain": os.getenv("universe_domain_KEY")
|
37 |
}
|
38 |
|
39 |
-
|
|
|
|
|
40 |
firebase = pyrebase.initialize_app(firebaseConfig)
|
41 |
storage = firebase.storage()
|
42 |
path = "Faces/"
|
|
|
4 |
from retinaface import RetinaFace
|
5 |
from deepface import DeepFace
|
6 |
from fastapi import FastAPI
|
7 |
+
import firebase_admin
|
8 |
+
from firebase_admin import credentials
|
9 |
+
from decouple import config
|
10 |
+
|
11 |
app = FastAPI()
|
12 |
+
|
13 |
@app.get("/")
|
14 |
def read_root():
|
15 |
return {"Hello": "World"}
|
16 |
|
17 |
@app.get("/verify/")
|
18 |
def verify_image(url1):
|
19 |
+
firebase_config = {
|
20 |
+
"apiKey": config("FIREBASE_API_KEY"),
|
21 |
+
"authDomain": config("FIREBASE_AUTH_DOMAIN"),
|
22 |
+
"projectId": config("FIREBASE_PROJECT_ID"),
|
23 |
+
"storageBucket": config("FIREBASE_STORAGE_BUCKET"),
|
24 |
+
"messagingSenderId": config("FIREBASE_MESSAGING_SENDER_ID"),
|
25 |
+
"appId": config("FIREBASE_APP_ID"),
|
26 |
+
"databaseURL": config("FIREBASE_DATABASE_URL"),
|
27 |
+
"serviceAccount": config("FIREBASE_SERVICE_ACCOUNT_JSON")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
}
|
29 |
|
30 |
+
# Initialize the Firebase app with the service account JSON
|
31 |
+
cred = credentials.Certificate(firebase_config['serviceAccount'])
|
32 |
+
firebase_admin
|
33 |
firebase = pyrebase.initialize_app(firebaseConfig)
|
34 |
storage = firebase.storage()
|
35 |
path = "Faces/"
|
requirements.txt
CHANGED
@@ -8,5 +8,4 @@ fastapi==0.104.0
|
|
8 |
python-dateutil==2.8.2
|
9 |
python-jwt==4.0.0
|
10 |
pydantic==2.4.2
|
11 |
-
pydantic_core==2.10.1
|
12 |
-
python-dotenv==1.0.0
|
|
|
8 |
python-dateutil==2.8.2
|
9 |
python-jwt==4.0.0
|
10 |
pydantic==2.4.2
|
11 |
+
pydantic_core==2.10.1
|
|