Spaces:
Runtime error
Runtime error
update gradio
Browse files- app.py +8 -8
- requirements.txt +1 -1
app.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
from types import MethodType
|
2 |
|
3 |
-
import spaces
|
4 |
import os
|
5 |
import gradio as gr
|
6 |
import torch
|
@@ -14,7 +13,7 @@ from huggingface_hub import snapshot_download
|
|
14 |
from PIL import Image
|
15 |
from ip_adapter import StyleShot, StyleContentStableDiffusionControlNetPipeline
|
16 |
|
17 |
-
device = "cuda"
|
18 |
|
19 |
contour_detector = SOFT_HEDdetector()
|
20 |
lineart_detector = LineartDetector()
|
@@ -58,7 +57,6 @@ lineart_pipe = StyleContentStableDiffusionControlNetPipeline.from_pretrained(bas
|
|
58 |
lineart_styleshot = StyleShot(device, lineart_pipe, lineart_ip_ckpt, lineart_style_aware_encoder_path, lineart_transformer_block_path)
|
59 |
|
60 |
|
61 |
-
@spaces.GPU
|
62 |
def process(style_image, content_image, prompt, num_samples, image_resolution, condition_scale, style_scale,ddim_steps, guidance_scale, seed, a_prompt, n_prompt, btn1, Contour_Threshold=200):
|
63 |
weight_dtype = torch.float32
|
64 |
|
@@ -143,7 +141,7 @@ with block:
|
|
143 |
with gr.Column():
|
144 |
style_image = gr.Image(sources=['upload'], type="numpy", label='Style Image')
|
145 |
with gr.Column():
|
146 |
-
with gr.
|
147 |
with gr.Column():
|
148 |
content_image = gr.Image(sources=['upload'], type="numpy", label='Content Image (optional)')
|
149 |
btn1 = gr.Radio(
|
@@ -177,16 +175,18 @@ with block:
|
|
177 |
value='longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality')
|
178 |
|
179 |
with gr.Row():
|
180 |
-
|
181 |
-
|
|
|
182 |
with gr.Row():
|
183 |
with gr.Column(scale = 1):
|
184 |
contour_gallery = gr.Gallery(label='Contour Output', show_label=True, elem_id="gallery", columns=[1], rows=[1], height='auto')
|
185 |
with gr.Column(scale = 4):
|
186 |
image_gallery = gr.Gallery(label='Result for Contour', show_label=True, elem_id="gallery", columns=[4], rows=[1], height='auto')
|
187 |
with gr.Row():
|
188 |
-
|
189 |
-
|
|
|
190 |
with gr.Row():
|
191 |
with gr.Column(scale = 1):
|
192 |
line_gallery = gr.Gallery(label='Lineart Output', show_label=True, elem_id="gallery", columns=[1], rows=[1], height='auto')
|
|
|
1 |
from types import MethodType
|
2 |
|
|
|
3 |
import os
|
4 |
import gradio as gr
|
5 |
import torch
|
|
|
13 |
from PIL import Image
|
14 |
from ip_adapter import StyleShot, StyleContentStableDiffusionControlNetPipeline
|
15 |
|
16 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
17 |
|
18 |
contour_detector = SOFT_HEDdetector()
|
19 |
lineart_detector = LineartDetector()
|
|
|
57 |
lineart_styleshot = StyleShot(device, lineart_pipe, lineart_ip_ckpt, lineart_style_aware_encoder_path, lineart_transformer_block_path)
|
58 |
|
59 |
|
|
|
60 |
def process(style_image, content_image, prompt, num_samples, image_resolution, condition_scale, style_scale,ddim_steps, guidance_scale, seed, a_prompt, n_prompt, btn1, Contour_Threshold=200):
|
61 |
weight_dtype = torch.float32
|
62 |
|
|
|
141 |
with gr.Column():
|
142 |
style_image = gr.Image(sources=['upload'], type="numpy", label='Style Image')
|
143 |
with gr.Column():
|
144 |
+
with gr.Blocks():
|
145 |
with gr.Column():
|
146 |
content_image = gr.Image(sources=['upload'], type="numpy", label='Content Image (optional)')
|
147 |
btn1 = gr.Radio(
|
|
|
175 |
value='longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality')
|
176 |
|
177 |
with gr.Row():
|
178 |
+
gr.Markdown("### Results for Contour")
|
179 |
+
with gr.Row():
|
180 |
+
with gr.Blocks():
|
181 |
with gr.Row():
|
182 |
with gr.Column(scale = 1):
|
183 |
contour_gallery = gr.Gallery(label='Contour Output', show_label=True, elem_id="gallery", columns=[1], rows=[1], height='auto')
|
184 |
with gr.Column(scale = 4):
|
185 |
image_gallery = gr.Gallery(label='Result for Contour', show_label=True, elem_id="gallery", columns=[4], rows=[1], height='auto')
|
186 |
with gr.Row():
|
187 |
+
gr.Markdown("### Results for Lineart")
|
188 |
+
with gr.Row():
|
189 |
+
with gr.Blocks():
|
190 |
with gr.Row():
|
191 |
with gr.Column(scale = 1):
|
192 |
line_gallery = gr.Gallery(label='Lineart Output', show_label=True, elem_id="gallery", columns=[1], rows=[1], height='auto')
|
requirements.txt
CHANGED
@@ -8,5 +8,5 @@ accelerate==0.21.0
|
|
8 |
opencv-python==4.8.1.78
|
9 |
einops==0.7.0
|
10 |
botocore==1.34.68
|
11 |
-
gradio==
|
12 |
basicsr
|
|
|
8 |
opencv-python==4.8.1.78
|
9 |
einops==0.7.0
|
10 |
botocore==1.34.68
|
11 |
+
gradio==4.37.2
|
12 |
basicsr
|