Luis Oala commited on
Commit
07b87fb
1 Parent(s): 28f8462
Files changed (5) hide show
  1. LICENSE +21 -0
  2. README.md +3 -4
  3. app.py +11 -11
  4. server.py +1 -1
  5. setup.py +0 -1
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2021 OpenAI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
README.md CHANGED
@@ -1,8 +1,7 @@
1
  ---
2
- title: Glide Text2im
3
- emoji: 📊
4
- colorFrom: purple
5
- colorTo: gray
6
  sdk: gradio
7
  app_file: app.py
8
  pinned: false
1
  ---
2
+ title: glide-test
3
+ colorFrom: green
4
+ colorTo: green
 
5
  sdk: gradio
6
  app_file: app.py
7
  pinned: false
app.py CHANGED
@@ -17,6 +17,11 @@ from glide_text2im.model_creation import (
17
  model_and_diffusion_defaults_upsampler
18
  )
19
 
 
 
 
 
 
20
  # print("Loading models...")
21
  # app = FastAPI()
22
 
@@ -180,17 +185,12 @@ def to_base64(pil_image):
180
  pil_image.save(buffered, format="JPEG")
181
  return base64.b64encode(buffered.getvalue())
182
 
183
- title = "Interactive demo: glide-text2im"
184
- description = "Demo for OpenAI's GLIDE: Towards Photorealistic Image Generation and Editing with Text-Guided Diffusion Models."
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='What would you like to see?'),
190
- outputs=gr.outputs.Image(type="pil", label="Model input + completions"),
191
  title=title,
192
- description=description,
193
- article=article,
194
- examples=examples,
195
- enable_queue=True)
196
- iface.launch(debug=True)
17
  model_and_diffusion_defaults_upsampler
18
  )
19
 
20
+ """
21
+ credit: follows the gradio glide example by valhalla https://huggingface.co/spaces/valhalla/glide-text2im
22
+ """
23
+
24
+
25
  # print("Loading models...")
26
  # app = FastAPI()
27
 
185
  pil_image.save(buffered, format="JPEG")
186
  return base64.b64encode(buffered.getvalue())
187
 
188
+ title = "glide test"
189
+ 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/."
 
 
190
 
191
  iface = gr.Interface(fn=sample,
192
+ inputs=gr.inputs.Textbox(label='enter text'),
193
+ outputs=gr.outputs.Image(type="pil", label="..."),
194
  title=title,
195
+ description=description)
196
+ iface.launch(debug=True,enable_queue=True)
 
 
 
server.py CHANGED
@@ -172,4 +172,4 @@ def sample(prompt):
172
  def to_base64(pil_image):
173
  buffered = BytesIO()
174
  pil_image.save(buffered, format="JPEG")
175
- return base64.b64encode(buffered.getvalue())
172
  def to_base64(pil_image):
173
  buffered = BytesIO()
174
  pil_image.save(buffered, format="JPEG")
175
+ return base64.b64encode(buffered.getvalue())
setup.py CHANGED
@@ -1,5 +1,4 @@
1
  from setuptools import setup
2
-
3
  setup(
4
  name="glide-text2im",
5
  packages=["glide_text2im"],
1
  from setuptools import setup
 
2
  setup(
3
  name="glide-text2im",
4
  packages=["glide_text2im"],