oscared commited on
Commit
59a6556
2 Parent(s): 74074ff 49615aa

Merge branch 'main' of https://huggingface.co/spaces/oscared/mariposas_demo

Browse files
Files changed (2) hide show
  1. app.py +2 -2
  2. utils.py +1 -1
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import streamlit as st
2
 
3
- from utils import carga_model, genera
4
 
5
  ##pagina principla
6
  st.title('Generador de mariposas')
@@ -14,7 +14,7 @@ st.sidebar.caption('Demo creado en vivo.')
14
 
15
  ## cargamos el model
16
  repo_id = 'ceyda/butterfly_cropped_uniq1K_512'
17
- modelo_gan = carga_model(repo_id)
18
 
19
 
20
  ## genera 4 mariposas
 
1
  import streamlit as st
2
 
3
+ from utils import carga_modelo, genera
4
 
5
  ##pagina principla
6
  st.title('Generador de mariposas')
 
14
 
15
  ## cargamos el model
16
  repo_id = 'ceyda/butterfly_cropped_uniq1K_512'
17
+ modelo_gan = carga_modelo(repo_id)
18
 
19
 
20
  ## genera 4 mariposas
utils.py CHANGED
@@ -11,6 +11,6 @@ def carga_modelo(model_name='ceyda/butterfly_croppe_uniq1K_512',model_version=No
11
  def genera(gan, batch_size=1):
12
  with torch.no_grad():
13
  ims = gan.G(torch.randn(batch_size, gan.latent_dim).clamp_(0.0,1.0)*255)
14
- ims = ims.permute(0,2,3,1).deatch().cpu().numpy().asttype(np.uint8)
15
  return ims
16
 
 
11
  def genera(gan, batch_size=1):
12
  with torch.no_grad():
13
  ims = gan.G(torch.randn(batch_size, gan.latent_dim).clamp_(0.0,1.0)*255)
14
+ ims = ims.permute(0,2,3,1).detach().cpu().numpy().astype(np.uint8)
15
  return ims
16