Spaces:
Sleeping
Sleeping
revert
Browse files
app.py
CHANGED
@@ -14,11 +14,9 @@ from upsampling import get_pipeline, upscale_image
|
|
14 |
|
15 |
import gradio as gr
|
16 |
|
17 |
-
from huggingface_hub import login
|
|
|
18 |
|
19 |
-
login(token='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')
|
20 |
-
# HF_TOKEN = os.getenv('HF_TOKEN')
|
21 |
-
# hf_api = HfApi(token=HF_TOKEN)
|
22 |
|
23 |
# fix randomness
|
24 |
th.manual_seed(0)
|
@@ -167,9 +165,10 @@ def decompose_image_demo(im, model):
|
|
167 |
def combine_images_demo(im1, im2, model):
|
168 |
sample_method = 'ddim'
|
169 |
result = combine_components_slice(MODELS[model], GD[sample_method], im1, im2, indices='1,0,1,0', sample_method=sample_method, num_images=1, device=device)
|
170 |
-
result =
|
171 |
-
|
172 |
-
|
|
|
173 |
return result
|
174 |
|
175 |
|
@@ -200,7 +199,7 @@ MODELS = {
|
|
200 |
'CelebA-HQ': celeb_model
|
201 |
}
|
202 |
|
203 |
-
pipe = get_pipeline()
|
204 |
|
205 |
with gr.Blocks() as demo:
|
206 |
gr.Markdown(
|
@@ -265,7 +264,7 @@ with gr.Blocks() as demo:
|
|
265 |
|
266 |
|
267 |
with gr.Column(scale=1):
|
268 |
-
comb_output = gr.Image(type='
|
269 |
comb_button = gr.Button("Generate")
|
270 |
|
271 |
|
|
|
14 |
|
15 |
import gradio as gr
|
16 |
|
17 |
+
# from huggingface_hub import login
|
18 |
+
|
19 |
|
|
|
|
|
|
|
20 |
|
21 |
# fix randomness
|
22 |
th.manual_seed(0)
|
|
|
165 |
def combine_images_demo(im1, im2, model):
|
166 |
sample_method = 'ddim'
|
167 |
result = combine_components_slice(MODELS[model], GD[sample_method], im1, im2, indices='1,0,1,0', sample_method=sample_method, num_images=1, device=device)
|
168 |
+
result = result.permute(1, 2, 0).numpy()
|
169 |
+
# result = Image.fromarray(result.permute(1, 2, 0).numpy())
|
170 |
+
# if model == 'CelebA-HQ':
|
171 |
+
# return upscale_image(result, pipe)
|
172 |
return result
|
173 |
|
174 |
|
|
|
199 |
'CelebA-HQ': celeb_model
|
200 |
}
|
201 |
|
202 |
+
# pipe = get_pipeline()
|
203 |
|
204 |
with gr.Blocks() as demo:
|
205 |
gr.Markdown(
|
|
|
264 |
|
265 |
|
266 |
with gr.Column(scale=1):
|
267 |
+
comb_output = gr.Image(type='numpy')
|
268 |
comb_button = gr.Button("Generate")
|
269 |
|
270 |
|