dominiquebuford
commited on
Commit
·
a19569f
1
Parent(s):
8ebd70d
try new command
Browse files- app/app.py +14 -0
- requirements.txt +1 -0
app/app.py
CHANGED
@@ -2,6 +2,10 @@ import os
|
|
2 |
import base64
|
3 |
from flask import Flask, render_template,request
|
4 |
import config
|
|
|
|
|
|
|
|
|
5 |
#local imports
|
6 |
from detection_model_run import run_detection
|
7 |
from helper import preprocess_keypoints
|
@@ -9,9 +13,19 @@ from classification_model_run import run_classification
|
|
9 |
from generate_light import generate_new_image
|
10 |
from show_points import display_keypoints
|
11 |
|
|
|
12 |
app = Flask(__name__)
|
13 |
app.config.from_object(config)
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
UPLOAD_FOLDER = 'captures' # Define the directory to save uploaded images
|
16 |
|
17 |
# Ensure the upload directory exists
|
|
|
2 |
import base64
|
3 |
from flask import Flask, render_template,request
|
4 |
import config
|
5 |
+
#newly added
|
6 |
+
import json
|
7 |
+
from google.cloud import storage
|
8 |
+
from google.oauth2 import service_account
|
9 |
#local imports
|
10 |
from detection_model_run import run_detection
|
11 |
from helper import preprocess_keypoints
|
|
|
13 |
from generate_light import generate_new_image
|
14 |
from show_points import display_keypoints
|
15 |
|
16 |
+
|
17 |
app = Flask(__name__)
|
18 |
app.config.from_object(config)
|
19 |
|
20 |
+
credentials_raw = os.getenv('gcp_credentials')
|
21 |
+
if credentials_raw:
|
22 |
+
credentials_dict = json.loads(credentials_raw)
|
23 |
+
credentials = service_account.Credentials.from_service_account_info(credentials_dict)
|
24 |
+
client = storage.Client(credentials=credentials)
|
25 |
+
bucket = client.get_bucket('dl-individual-project')
|
26 |
+
else:
|
27 |
+
raise EnvironmentError("Failed to get 'GCP_CREDENTIALS' from environment.")
|
28 |
+
|
29 |
UPLOAD_FOLDER = 'captures' # Define the directory to save uploaded images
|
30 |
|
31 |
# Ensure the upload directory exists
|
requirements.txt
CHANGED
@@ -4,6 +4,7 @@ torch
|
|
4 |
torchvision
|
5 |
torchaudio
|
6 |
tensorflow
|
|
|
7 |
keras
|
8 |
pandas
|
9 |
gunicorn
|
|
|
4 |
torchvision
|
5 |
torchaudio
|
6 |
tensorflow
|
7 |
+
google-cloud-storage
|
8 |
keras
|
9 |
pandas
|
10 |
gunicorn
|