Jainam Jain commited on
Commit
58c9975
1 Parent(s): 25d75f1
Files changed (3) hide show
  1. .env +23 -18
  2. app.py +17 -24
  3. requirements.txt +1 -2
.env CHANGED
@@ -1,18 +1,23 @@
1
- API_KEY=AIzaSyClnRJAnrJgAgkYjuYnlvu-CJ6Cxyklebo
2
- authDomain_KEY=socioverse-2025.firebaseapp.com
3
- projectId_KEY=socioverse-2025
4
- storageBucket_KEY=socioverse-2025.appspot.com
5
- messagingSenderId_KEY=689574504641
6
- appId_KEY=1:689574504641:web:a22f6a2fa343e4221acc40
7
- databaseURL_KEY=https://console.firebase.google.com/project/socioverse-2025/storage/socioverse-2025.appspot.com/files
8
- type_KEY=service_account
9
- project_id_KEY=socioverse-2025
10
- private_key_id_KEY=dde07d7cbca92e48903b77629995db2517ae90b7
11
- private_key_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\ngX3eHtMN8uNFt7hLTWvwcJW4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\n-----END PRIVATE KEY-----\n
12
- client_email_KEY=firebase-adminsdk-gcc6m@socioverse-2025.iam.gserviceaccount.com
13
- client_id_KEY=107273420733077415353
14
- auth_uri_KEY=https://accounts.google.com/o/oauth2/auth
15
- token_uri_KEY=https://oauth2.googleapis.com/token
16
- auth_provider_x509_cert_url_KEY=https://www.googleapis.com/oauth2/v1/certs
17
- client_x509_cert_url_KEY=https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-gcc6m%40socioverse-2025.iam.gserviceaccount.com
18
- universe_domain_KEY=googleapis.com
 
 
 
 
 
 
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 os
8
- from dotenv import load_dotenv
 
 
9
  app = FastAPI()
10
- load_dotenv
11
  @app.get("/")
12
  def read_root():
13
  return {"Hello": "World"}
14
 
15
  @app.get("/verify/")
16
  def verify_image(url1):
17
- firebaseConfig = {
18
- "apiKey": os.getenv("API_KEY"),
19
- "authDomain": os.getenv("authDomain_KEY"),
20
- "projectId": os.getenv("projectId_KEY"),
21
- "storageBucket": os.getenv("storageBucket_KEY"),
22
- "messagingSenderId": os.getenv("messagingSenderId_KEY"),
23
- "appId": os.getenv("appId_KEY"),
24
- "databaseURL": os.getenv("databaseURL_KEY"),
25
- "serviceAccount": {
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