Spaces:
Sleeping
Sleeping
access token added
Browse files
app.py
CHANGED
|
@@ -1,10 +1,18 @@
|
|
| 1 |
import streamlit as st
|
|
|
|
| 2 |
|
| 3 |
from utils import load_model, generate
|
| 4 |
|
| 5 |
st.title('Image Generator with GAN')
|
| 6 |
st.markdown('Butterflies generator')
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
# Sidebar
|
| 9 |
st.sidebar.subheader('This butterfly does not exist, it is completely generated!')
|
| 10 |
st.sidebar.image('assets/logo.jpeg', width=200)
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
import os
|
| 3 |
|
| 4 |
from utils import load_model, generate
|
| 5 |
|
| 6 |
st.title('Image Generator with GAN')
|
| 7 |
st.markdown('Butterflies generator')
|
| 8 |
|
| 9 |
+
st.write("Token Access:", st.secrets["access_token"])
|
| 10 |
+
|
| 11 |
+
st.write(
|
| 12 |
+
"Has environment variables been set:",
|
| 13 |
+
os.environ["access_token"] == st.secrets["access_token"])
|
| 14 |
+
|
| 15 |
+
|
| 16 |
# Sidebar
|
| 17 |
st.sidebar.subheader('This butterfly does not exist, it is completely generated!')
|
| 18 |
st.sidebar.image('assets/logo.jpeg', width=200)
|
utils.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
import numpy as np
|
| 2 |
-
import torch
|
|
|
|
| 3 |
from huggan.pytorch.lightweight_gan.lightweight_gan import LightweightGAN
|
| 4 |
|
| 5 |
-
|
| 6 |
def load_model(model_name='ceyda/butterfly_cropped_uniq1K_512', model_version=None):
|
| 7 |
-
gan = LightweightGAN.from_pretrained(model_name, version=model_version)
|
| 8 |
gan.eval()
|
| 9 |
return gan
|
| 10 |
|
|
|
|
| 1 |
import numpy as np
|
| 2 |
+
import torch
|
| 3 |
+
import os
|
| 4 |
from huggan.pytorch.lightweight_gan.lightweight_gan import LightweightGAN
|
| 5 |
|
|
|
|
| 6 |
def load_model(model_name='ceyda/butterfly_cropped_uniq1K_512', model_version=None):
|
| 7 |
+
gan = LightweightGAN.from_pretrained(model_name, version=model_version, token=os.environ["access_token"])
|
| 8 |
gan.eval()
|
| 9 |
return gan
|
| 10 |
|