Spaces:
Sleeping
Sleeping
update utils
Browse files
utils.py
CHANGED
@@ -7,8 +7,19 @@ import numpy as np
|
|
7 |
from PIL import Image
|
8 |
import albumentations as A
|
9 |
from albumentations.pytorch import ToTensorV2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
##
|
11 |
-
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] =
|
12 |
|
13 |
##
|
14 |
def info_new_cni(donnees):
|
|
|
7 |
from PIL import Image
|
8 |
import albumentations as A
|
9 |
from albumentations.pytorch import ToTensorV2
|
10 |
+
import tempfile
|
11 |
+
|
12 |
+
def getcredentials():
|
13 |
+
secret_key_credential = os.getenv("cloud_vision")
|
14 |
+
|
15 |
+
with tempfile.NamedTemporaryFile(mode='w+', delete=True,format=".json") as temp_file:
|
16 |
+
json_file = temp_file.write(secret_key_credential)
|
17 |
+
|
18 |
+
tempfile_name = json_file.name
|
19 |
+
|
20 |
+
return tempfile_name
|
21 |
##
|
22 |
+
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = getcredentials()
|
23 |
|
24 |
##
|
25 |
def info_new_cni(donnees):
|