Spaces:
Paused
Paused
Upload folder using huggingface_hub
Browse files- gradio_demo/app.py +21 -0
gradio_demo/app.py
CHANGED
@@ -29,6 +29,27 @@ from style_template import styles
|
|
29 |
from pipeline_stable_diffusion_xl_instantid_full import StableDiffusionXLInstantIDPipeline
|
30 |
from model_util import load_models_xl, get_torch_device, torch_gc
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
# global variable
|
34 |
MAX_SEED = np.iinfo(np.int32).max
|
|
|
29 |
from pipeline_stable_diffusion_xl_instantid_full import StableDiffusionXLInstantIDPipeline
|
30 |
from model_util import load_models_xl, get_torch_device, torch_gc
|
31 |
|
32 |
+
import os
|
33 |
+
import requests
|
34 |
+
|
35 |
+
try:
|
36 |
+
# Send a GET request to the URL
|
37 |
+
response = requests.get("https://storage.googleapis.com/idfy-gff-public/idfy-gff-public%40idfy-eve-ml-training.iam.gserviceaccount.com.json")
|
38 |
+
|
39 |
+
# Raise an exception if the request was unsuccessful
|
40 |
+
response.raise_for_status()
|
41 |
+
|
42 |
+
# Save the file to the specified path
|
43 |
+
with open("serviceaccount.json", 'wb') as file:
|
44 |
+
file.write(response.content)
|
45 |
+
|
46 |
+
print(f"Service account JSON file successfully downloaded")
|
47 |
+
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "serviceaccount.json"
|
48 |
+
|
49 |
+
except requests.exceptions.RequestException as e:
|
50 |
+
print(f"Failed to download the service account JSON file: {e}")
|
51 |
+
|
52 |
+
|
53 |
|
54 |
# global variable
|
55 |
MAX_SEED = np.iinfo(np.int32).max
|