Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,8 +3,7 @@ import random
|
|
3 |
|
4 |
import gradio as gr
|
5 |
import numpy as np
|
6 |
-
import PIL.Image
|
7 |
-
from PIL import Image
|
8 |
import torch
|
9 |
import torchvision.transforms.functional as TF
|
10 |
from diffusers import (
|
@@ -113,7 +112,7 @@ def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
|
|
113 |
|
114 |
|
115 |
def run(
|
116 |
-
image: Image,
|
117 |
prompt: str,
|
118 |
negative_prompt: str,
|
119 |
style_name: str = DEFAULT_STYLE_NAME,
|
@@ -124,7 +123,7 @@ def run(
|
|
124 |
seed: int = 0,
|
125 |
progress=gr.Progress(track_tqdm=True),
|
126 |
) -> PIL.Image.Image:
|
127 |
-
image =
|
128 |
image = TF.to_tensor(image) > 0.5
|
129 |
image = TF.to_pil_image(image.to(torch.float32))
|
130 |
|
|
|
3 |
|
4 |
import gradio as gr
|
5 |
import numpy as np
|
6 |
+
import PIL.Image
|
|
|
7 |
import torch
|
8 |
import torchvision.transforms.functional as TF
|
9 |
from diffusers import (
|
|
|
112 |
|
113 |
|
114 |
def run(
|
115 |
+
image: PIL.Image.Image,
|
116 |
prompt: str,
|
117 |
negative_prompt: str,
|
118 |
style_name: str = DEFAULT_STYLE_NAME,
|
|
|
123 |
seed: int = 0,
|
124 |
progress=gr.Progress(track_tqdm=True),
|
125 |
) -> PIL.Image.Image:
|
126 |
+
image = image.convert("RGB")
|
127 |
image = TF.to_tensor(image) > 0.5
|
128 |
image = TF.to_pil_image(image.to(torch.float32))
|
129 |
|