Spaces:
Runtime error
Runtime error
Luis Oala
commited on
Commit
·
76860ac
1
Parent(s):
d62813f
first try
Browse files
app.py
CHANGED
@@ -183,14 +183,12 @@ def to_base64(pil_image):
|
|
183 |
pil_image.save(buffered, format="JPEG")
|
184 |
return base64.b64encode(buffered.getvalue())
|
185 |
|
186 |
-
title = "
|
187 |
-
description = "
|
188 |
-
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2112.10741'>GLIDE: Towards Photorealistic Image Generation and Editing with Text-Guided Diffusion Models</a> | <a href='https://github.com/openai/glide-text2im/'>Official Repo</a></p>"
|
189 |
-
examples =["an oil painting of a corgi"]
|
190 |
|
191 |
iface = gr.Interface(fn=sample,
|
192 |
-
inputs=gr.inputs.Textbox(label='
|
193 |
-
outputs=gr.outputs.Image(type="pil", label="
|
194 |
title=title,
|
195 |
description=description,
|
196 |
article=article,
|
|
|
183 |
pil_image.save(buffered, format="JPEG")
|
184 |
return base64.b64encode(buffered.getvalue())
|
185 |
|
186 |
+
title = "glide test"
|
187 |
+
description = "text conditioned image generation demo using openai's GLIDE model (text-guided diffusion model) https://arxiv.org/abs/2112.10741 & https://github.com/openai/glide-text2im/. should take ~500s to run. credit to valhalla for gradio template https://huggingface.co/spaces/valhalla/."
|
|
|
|
|
188 |
|
189 |
iface = gr.Interface(fn=sample,
|
190 |
+
inputs=gr.inputs.Textbox(label='enter text'),
|
191 |
+
outputs=gr.outputs.Image(type="pil", label="model input + completions"),
|
192 |
title=title,
|
193 |
description=description,
|
194 |
article=article,
|
app.py~
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
|
2 |
import os
|
3 |
os.system('pip install -e .')
|
4 |
import gradio as gr
|
@@ -24,6 +23,10 @@ from glide_text2im.model_creation import (
|
|
24 |
# On CPU, generating one sample may take on the order of 20 minutes.
|
25 |
# On a GPU, it should be under a minute.
|
26 |
|
|
|
|
|
|
|
|
|
27 |
has_cuda = th.cuda.is_available()
|
28 |
device = th.device('cpu' if not has_cuda else 'cuda')
|
29 |
|
@@ -180,17 +183,15 @@ def to_base64(pil_image):
|
|
180 |
pil_image.save(buffered, format="JPEG")
|
181 |
return base64.b64encode(buffered.getvalue())
|
182 |
|
183 |
-
title = "
|
184 |
-
description = "
|
185 |
-
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2112.10741'>GLIDE: Towards Photorealistic Image Generation and Editing with Text-Guided Diffusion Models</a> | <a href='https://github.com/openai/glide-text2im/'>Official Repo</a></p>"
|
186 |
-
examples =["an oil painting of a corgi"]
|
187 |
|
188 |
iface = gr.Interface(fn=sample,
|
189 |
-
inputs=gr.inputs.Textbox(label='
|
190 |
-
outputs=gr.outputs.Image(type="pil", label="
|
191 |
title=title,
|
192 |
description=description,
|
193 |
article=article,
|
194 |
examples=examples,
|
195 |
enable_queue=True)
|
196 |
-
iface.launch(debug=True)
|
|
|
|
|
1 |
import os
|
2 |
os.system('pip install -e .')
|
3 |
import gradio as gr
|
|
|
23 |
# On CPU, generating one sample may take on the order of 20 minutes.
|
24 |
# On a GPU, it should be under a minute.
|
25 |
|
26 |
+
"""
|
27 |
+
credit: follows the gradio glide example by valhalla https://huggingface.co/spaces/valhalla/glide-text2im
|
28 |
+
"""
|
29 |
+
|
30 |
has_cuda = th.cuda.is_available()
|
31 |
device = th.device('cpu' if not has_cuda else 'cuda')
|
32 |
|
|
|
183 |
pil_image.save(buffered, format="JPEG")
|
184 |
return base64.b64encode(buffered.getvalue())
|
185 |
|
186 |
+
title = "glide test"
|
187 |
+
description = "text conditioned image generation demo using openai's GLIDE model (text-guided diffusion model) https://arxiv.org/abs/2112.10741 & https://github.com/openai/glide-text2im/. Credit to valhalla for gradio template https://huggingface.co/spaces/valhalla/."
|
|
|
|
|
188 |
|
189 |
iface = gr.Interface(fn=sample,
|
190 |
+
inputs=gr.inputs.Textbox(label='enter text'),
|
191 |
+
outputs=gr.outputs.Image(type="pil", label="model input + completions"),
|
192 |
title=title,
|
193 |
description=description,
|
194 |
article=article,
|
195 |
examples=examples,
|
196 |
enable_queue=True)
|
197 |
+
iface.launch(debug=True)
|