Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,11 +8,12 @@ RES = None
|
|
| 8 |
models = [
|
| 9 |
{'type': 'pokemon', 'res': 64, 'id': 'mrm8488/ddpm-ema-pokemon-64'},
|
| 10 |
{'type': 'flowers', 'res': 64, 'id': 'mrm8488/ddpm-ema-flower-64'},
|
| 11 |
-
{'type': 'anime_faces', 'res': 128, 'id': 'mrm8488/ddpm-ema-anime-
|
| 12 |
{'type': 'butterflies', 'res': 128, 'id': 'mrm8488/ddpm-ema-butterflies-128'},
|
| 13 |
-
{'type': 'human_faces', 'res': 256, 'id': 'fusing/ddpm-celeba-hq'}
|
| 14 |
]
|
| 15 |
for model in models:
|
|
|
|
| 16 |
pipeline = DDPMPipeline.from_pretrained(model['id'])
|
| 17 |
pipeline.save_pretrained('.')
|
| 18 |
model['pipeline'] = pipeline
|
|
@@ -25,9 +26,6 @@ def predict(type):
|
|
| 25 |
pipeline = model['pipeline']
|
| 26 |
RES = model['res']
|
| 27 |
break
|
| 28 |
-
# load model and scheduler
|
| 29 |
-
#pipeline = DDPMPipeline.from_pretrained(model_id)
|
| 30 |
-
|
| 31 |
# run pipeline in inference
|
| 32 |
image = pipeline()["sample"]
|
| 33 |
|
|
@@ -38,7 +36,7 @@ gr.Interface(
|
|
| 38 |
predict,
|
| 39 |
inputs=[gr.components.Dropdown(choices=[model['type'] for model in models], label='Choose a model')
|
| 40 |
],
|
| 41 |
-
outputs=[gr.Image(shape=[
|
| 42 |
elem_id="generated_image")],
|
| 43 |
title=title,
|
| 44 |
description=description
|
|
|
|
| 8 |
models = [
|
| 9 |
{'type': 'pokemon', 'res': 64, 'id': 'mrm8488/ddpm-ema-pokemon-64'},
|
| 10 |
{'type': 'flowers', 'res': 64, 'id': 'mrm8488/ddpm-ema-flower-64'},
|
| 11 |
+
{'type': 'anime_faces', 'res': 128, 'id': 'mrm8488/ddpm-ema-anime-v2-128'},
|
| 12 |
{'type': 'butterflies', 'res': 128, 'id': 'mrm8488/ddpm-ema-butterflies-128'},
|
| 13 |
+
#{'type': 'human_faces', 'res': 256, 'id': 'fusing/ddpm-celeba-hq'}
|
| 14 |
]
|
| 15 |
for model in models:
|
| 16 |
+
print(model)
|
| 17 |
pipeline = DDPMPipeline.from_pretrained(model['id'])
|
| 18 |
pipeline.save_pretrained('.')
|
| 19 |
model['pipeline'] = pipeline
|
|
|
|
| 26 |
pipeline = model['pipeline']
|
| 27 |
RES = model['res']
|
| 28 |
break
|
|
|
|
|
|
|
|
|
|
| 29 |
# run pipeline in inference
|
| 30 |
image = pipeline()["sample"]
|
| 31 |
|
|
|
|
| 36 |
predict,
|
| 37 |
inputs=[gr.components.Dropdown(choices=[model['type'] for model in models], label='Choose a model')
|
| 38 |
],
|
| 39 |
+
outputs=[gr.Image(shape=[64, 64], type="pil",
|
| 40 |
elem_id="generated_image")],
|
| 41 |
title=title,
|
| 42 |
description=description
|