Spaces:
Runtime error
Runtime error
verkaDerkaDerk
commited on
Commit
•
6a3f247
1
Parent(s):
f00f804
Update app.py
Browse files
app.py
CHANGED
@@ -1,44 +1,19 @@
|
|
1 |
import gradio as gr
|
2 |
-
import PIL
|
3 |
from diffusers import DDPMPipeline, DDIMPipeline, PNDMPipeline
|
4 |
|
5 |
MODEL_ID = "verkaDerkaDerk/tiki-based-128"
|
6 |
-
PIPELINE =
|
7 |
|
8 |
-
def
|
9 |
-
|
10 |
-
gr.Interface.from_pipeline(PIPELINE).launch()
|
11 |
-
|
12 |
-
def imagine(name):
|
13 |
image = PIPELINE()["sample"][0]
|
14 |
-
print( f"type is {type(image)}" )
|
15 |
-
# type is <class 'PIL.Image.Image'>
|
16 |
-
gr_image = gr.Image( image )
|
17 |
-
print( f"type iz {type(gr_image)}" )
|
18 |
-
# type iz <class 'gradio.components.Image'>
|
19 |
-
if isinstance(image, PIL.Image.Image):
|
20 |
-
print( "of course it is a PIL.Image.Image")
|
21 |
-
else:
|
22 |
-
print( "oddly, it is not a PIL.Image.Image")
|
23 |
return image
|
24 |
-
|
25 |
-
def greet(name):
|
26 |
-
return f"Sup, {name}?"
|
27 |
|
28 |
def main():
|
29 |
-
|
30 |
-
|
31 |
-
outputs = gr.Image(type="pil")
|
32 |
outputs = "pil"
|
33 |
-
gr.Interface(fn=imagine, inputs=
|
34 |
-
# ValueError: Cannot process this value as an Image
|
35 |
-
|
36 |
-
#demo = gr.Interface(image_mod, gr.Image(type="pil"), "image",
|
37 |
-
# flagging_options=["blurry", "incorrect", "other"], examples=[
|
38 |
-
# os.path.join(os.path.dirname(__file__), "images/cheetah1.jpg"),
|
39 |
-
# os.path.join(os.path.dirname(__file__), "images/lion.jpg"),
|
40 |
-
# os.path.join(os.path.dirname(__file__), "images/logo.png")
|
41 |
-
#])
|
42 |
|
43 |
|
44 |
main()
|
|
|
1 |
import gradio as gr
|
|
|
2 |
from diffusers import DDPMPipeline, DDIMPipeline, PNDMPipeline
|
3 |
|
4 |
MODEL_ID = "verkaDerkaDerk/tiki-based-128"
|
5 |
+
PIPELINE = PNDMPipeline.from_pretrained(MODEL_ID)
|
6 |
|
7 |
+
#def imagine(name):
|
8 |
+
def imagine():
|
|
|
|
|
|
|
9 |
image = PIPELINE()["sample"][0]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
return image
|
|
|
|
|
|
|
11 |
|
12 |
def main():
|
13 |
+
inputs = "text"
|
14 |
+
inputs = None
|
|
|
15 |
outputs = "pil"
|
16 |
+
gr.Interface(fn=imagine, inputs=inputs, outputs=outputs).launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
|
19 |
main()
|