Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
3fd4792
1
Parent(s):
8dfff83
fix output
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ from typing import Sequence, Mapping, Any, Union
|
|
5 |
import torch
|
6 |
import gradio as gr
|
7 |
from PIL import Image
|
|
|
8 |
from huggingface_hub import hf_hub_download
|
9 |
import spaces
|
10 |
from comfy import model_management
|
@@ -168,8 +169,13 @@ def generate_image(prompt, negative_prompt, width, height, steps, cfg, seed):
|
|
168 |
vae=get_value_at_index(vaeloader_80, 0),
|
169 |
)
|
170 |
|
171 |
-
#
|
172 |
-
|
|
|
|
|
|
|
|
|
|
|
173 |
|
174 |
# Create Gradio interface
|
175 |
with gr.Blocks() as app:
|
|
|
5 |
import torch
|
6 |
import gradio as gr
|
7 |
from PIL import Image
|
8 |
+
import numpy as np
|
9 |
from huggingface_hub import hf_hub_download
|
10 |
import spaces
|
11 |
from comfy import model_management
|
|
|
169 |
vae=get_value_at_index(vaeloader_80, 0),
|
170 |
)
|
171 |
|
172 |
+
# Convert tensor to PIL Image
|
173 |
+
image_tensor = get_value_at_index(vaedecode_79, 0)
|
174 |
+
# Convert from [0,1] to [0,255] range and ensure it's in the right format
|
175 |
+
image_np = (image_tensor.cpu().numpy() * 255).astype(np.uint8)
|
176 |
+
# Convert to PIL Image
|
177 |
+
image = Image.fromarray(image_np)
|
178 |
+
return image
|
179 |
|
180 |
# Create Gradio interface
|
181 |
with gr.Blocks() as app:
|