Spaces:
Running
on
Zero
Running
on
Zero
gradio_proceess_imageを消す
Browse files
app.py
CHANGED
@@ -14,6 +14,7 @@ initialize(_use_local=False, use_gpu=True, use_dotenv=False)
|
|
14 |
init_model(use_local=False)
|
15 |
load_wd14_tagger_model()
|
16 |
|
|
|
17 |
def process_image(input_image, mode, weight1, weight2):
|
18 |
# 画像処理ロジック
|
19 |
sotai_image, sketch_image = process_image_as_base64(input_image, mode, weight1, weight2)
|
@@ -24,11 +25,6 @@ def process_image(input_image, mode, weight1, weight2):
|
|
24 |
|
25 |
return sotai_pil, sketch_pil
|
26 |
|
27 |
-
@spaces.GPU
|
28 |
-
def gradio_process_image(input_image, mode, weight1, weight2):
|
29 |
-
sotai_image, sketch_image = process_image(input_image, mode, weight1, weight2)
|
30 |
-
return sotai_image, sketch_image
|
31 |
-
|
32 |
# サンプル画像のパスリスト
|
33 |
sample_images = [
|
34 |
'images/sample1.png',
|
@@ -75,12 +71,12 @@ with gr.Blocks() as demo:
|
|
75 |
examples=[[path, "original", 0.6, 0.05] for path in sample_images],
|
76 |
inputs=[input_image, mode, weight1, weight2],
|
77 |
outputs=[sotai_output, sketch_output],
|
78 |
-
fn=
|
79 |
cache_examples=True,
|
80 |
)
|
81 |
|
82 |
process_btn.click(
|
83 |
-
fn=
|
84 |
inputs=[input_image, mode, weight1, weight2],
|
85 |
outputs=[sotai_output, sketch_output]
|
86 |
)
|
|
|
14 |
init_model(use_local=False)
|
15 |
load_wd14_tagger_model()
|
16 |
|
17 |
+
@spaces.GPU
|
18 |
def process_image(input_image, mode, weight1, weight2):
|
19 |
# 画像処理ロジック
|
20 |
sotai_image, sketch_image = process_image_as_base64(input_image, mode, weight1, weight2)
|
|
|
25 |
|
26 |
return sotai_pil, sketch_pil
|
27 |
|
|
|
|
|
|
|
|
|
|
|
28 |
# サンプル画像のパスリスト
|
29 |
sample_images = [
|
30 |
'images/sample1.png',
|
|
|
71 |
examples=[[path, "original", 0.6, 0.05] for path in sample_images],
|
72 |
inputs=[input_image, mode, weight1, weight2],
|
73 |
outputs=[sotai_output, sketch_output],
|
74 |
+
fn=process_image,
|
75 |
cache_examples=True,
|
76 |
)
|
77 |
|
78 |
process_btn.click(
|
79 |
+
fn=process_image,
|
80 |
inputs=[input_image, mode, weight1, weight2],
|
81 |
outputs=[sotai_output, sketch_output]
|
82 |
)
|