Spaces:
Sleeping
Sleeping
Commit
·
6986302
1
Parent(s):
32b48df
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,4 @@
|
|
1 |
-
import json
|
2 |
-
|
3 |
import streamlit as st
|
4 |
-
from huggingface_hub import hf_hub_download
|
5 |
from utils import carga_modelo, genera
|
6 |
|
7 |
## Página principal
|
@@ -16,46 +13,8 @@ st.sidebar.image("assets/logo.png", width=200)
|
|
16 |
st.sidebar.caption("Demo creado en vivo.")
|
17 |
|
18 |
## Cargamos el modelo
|
19 |
-
|
20 |
-
|
21 |
-
revision = None
|
22 |
-
cache_dir = None
|
23 |
-
force_download = False
|
24 |
-
proxies = None
|
25 |
-
resume_download = False
|
26 |
-
local_files_only = False
|
27 |
-
token = None
|
28 |
-
|
29 |
-
|
30 |
-
# Load the config
|
31 |
-
config_file = hf_hub_download(
|
32 |
-
repo_id=str(model_id),
|
33 |
-
filename=CONFIG_NAME,
|
34 |
-
revision=revision,
|
35 |
-
cache_dir=cache_dir,
|
36 |
-
force_download=force_download,
|
37 |
-
proxies=proxies,
|
38 |
-
resume_download=resume_download,
|
39 |
-
token=token,
|
40 |
-
local_files_only=local_files_only,
|
41 |
-
)
|
42 |
-
with open(config_file, "r", encoding="utf-8") as f:
|
43 |
-
config = json.load(f)
|
44 |
-
|
45 |
-
# Call the _from_pretrained with all the needed arguments
|
46 |
-
gan = LightweightGAN()._from_pretrained(
|
47 |
-
model_id=str(model_id),
|
48 |
-
revision=revision,
|
49 |
-
cache_dir=cache_dir,
|
50 |
-
force_download=force_download,
|
51 |
-
proxies=proxies,
|
52 |
-
resume_download=resume_download,
|
53 |
-
local_files_only=local_files_only,
|
54 |
-
token=token,
|
55 |
-
use_auth_token=False,
|
56 |
-
config=config, # usually in **model_kwargs
|
57 |
-
)
|
58 |
-
modelo_gan = carga_modelo(model_id)
|
59 |
|
60 |
# Numero de mariposas a generar
|
61 |
n_mariposas = 4
|
@@ -82,4 +41,3 @@ if ims is not None:
|
|
82 |
for j, im in enumerate(ims):
|
83 |
i = j % n_mariposas
|
84 |
cols[i].image(im, use_column_width=True)
|
85 |
-
|
|
|
|
|
|
|
1 |
import streamlit as st
|
|
|
2 |
from utils import carga_modelo, genera
|
3 |
|
4 |
## Página principal
|
|
|
13 |
st.sidebar.caption("Demo creado en vivo.")
|
14 |
|
15 |
## Cargamos el modelo
|
16 |
+
repo_id = "ceyda/butterfly_cropped_uniq1K_512"
|
17 |
+
modelo_gan = carga_modelo(repo_id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
# Numero de mariposas a generar
|
20 |
n_mariposas = 4
|
|
|
41 |
for j, im in enumerate(ims):
|
42 |
i = j % n_mariposas
|
43 |
cols[i].image(im, use_column_width=True)
|
|