Spaces:
Runtime error
Runtime error
Update utils.py
Browse files
utils.py
CHANGED
|
@@ -10,6 +10,7 @@ import numpy as np
|
|
| 10 |
from PIL import Image
|
| 11 |
from dalle.models import Dalle
|
| 12 |
from dalle.utils.utils import set_seed, clip_score
|
|
|
|
| 13 |
|
| 14 |
def link(link, text, **style):
|
| 15 |
return a(_href=link, _target="_blank", style=styles(**style))(text)
|
|
@@ -64,6 +65,8 @@ def layout(*args):
|
|
| 64 |
|
| 65 |
st.markdown(str(foot), unsafe_allow_html=True)
|
| 66 |
|
|
|
|
|
|
|
| 67 |
def footer():
|
| 68 |
myargs = [
|
| 69 |
"Created by ",
|
|
@@ -78,6 +81,22 @@ def footer():
|
|
| 78 |
layout(*myargs)
|
| 79 |
|
| 80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
model = False
|
| 82 |
def generate(prompt,crazy,k):
|
| 83 |
global model
|
|
@@ -93,8 +112,6 @@ def generate(prompt,crazy,k):
|
|
| 93 |
|
| 94 |
set_seed(np.random.randint(0,10000))
|
| 95 |
|
| 96 |
-
|
| 97 |
-
|
| 98 |
# Sampling
|
| 99 |
images = model.sampling(prompt=prompt,
|
| 100 |
top_k=2048,
|
|
|
|
| 10 |
from PIL import Image
|
| 11 |
from dalle.models import Dalle
|
| 12 |
from dalle.utils.utils import set_seed, clip_score
|
| 13 |
+
import streamlit.components.v1 as components
|
| 14 |
|
| 15 |
def link(link, text, **style):
|
| 16 |
return a(_href=link, _target="_blank", style=styles(**style))(text)
|
|
|
|
| 65 |
|
| 66 |
st.markdown(str(foot), unsafe_allow_html=True)
|
| 67 |
|
| 68 |
+
|
| 69 |
+
|
| 70 |
def footer():
|
| 71 |
myargs = [
|
| 72 |
"Created by ",
|
|
|
|
| 81 |
layout(*myargs)
|
| 82 |
|
| 83 |
|
| 84 |
+
components.html(
|
| 85 |
+
"""
|
| 86 |
+
<!-- Global site tag (gtag.js) - Google Analytics -->
|
| 87 |
+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-SB6NJ9DQS7"></script>
|
| 88 |
+
<script>
|
| 89 |
+
window.dataLayer = window.dataLayer || [];
|
| 90 |
+
function gtag(){dataLayer.push(arguments);}
|
| 91 |
+
gtag('js', new Date());
|
| 92 |
+
|
| 93 |
+
gtag('config', 'G-SB6NJ9DQS7');
|
| 94 |
+
</script>
|
| 95 |
+
""",
|
| 96 |
+
height=600,
|
| 97 |
+
)
|
| 98 |
+
|
| 99 |
+
|
| 100 |
model = False
|
| 101 |
def generate(prompt,crazy,k):
|
| 102 |
global model
|
|
|
|
| 112 |
|
| 113 |
set_seed(np.random.randint(0,10000))
|
| 114 |
|
|
|
|
|
|
|
| 115 |
# Sampling
|
| 116 |
images = model.sampling(prompt=prompt,
|
| 117 |
top_k=2048,
|