Spaces:
Runtime error
Runtime error
Speed improvements and possible error fix
Browse filesto speedup build I've mode your packages requirements to requirements.txt
```
openmim
mmpose
mmdet
psutil```
disable queue for button
- README.md +2 -2
- app.py +5 -5
- demo/demos.py +1 -17
- requirements.txt +7 -1
README.md
CHANGED
@@ -2,11 +2,11 @@
|
|
2 |
license: openrail
|
3 |
title: T2I-Adapter
|
4 |
sdk: gradio
|
5 |
-
sdk_version: 3.
|
6 |
emoji: 😻
|
7 |
colorFrom: pink
|
8 |
colorTo: blue
|
9 |
pinned: false
|
10 |
python_version: 3.8.16
|
11 |
app_file: app.py
|
12 |
-
---
|
|
|
2 |
license: openrail
|
3 |
title: T2I-Adapter
|
4 |
sdk: gradio
|
5 |
+
sdk_version: 3.19.1
|
6 |
emoji: 😻
|
7 |
colorFrom: pink
|
8 |
colorTo: blue
|
9 |
pinned: false
|
10 |
python_version: 3.8.16
|
11 |
app_file: app.py
|
12 |
+
---
|
app.py
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
import os
|
2 |
-
os.system('pip3 install openmim')
|
3 |
os.system('mim install mmcv-full==1.7.0')
|
4 |
-
os.system('pip3 install mmpose')
|
5 |
-
os.system('pip3 install mmdet')
|
6 |
-
os.system('pip3 install gradio==3.19.1')
|
7 |
|
8 |
from demo.model import Model_all
|
9 |
import gradio as gr
|
@@ -64,4 +64,4 @@ with gr.Blocks(css='style.css') as demo:
|
|
64 |
|
65 |
# demo.queue(api_open=False).launch(server_name='0.0.0.0')
|
66 |
# demo.queue(show_api=False, enable_queue=False).launch(server_name='0.0.0.0')
|
67 |
-
demo.queue().launch(debug=True)
|
|
|
1 |
import os
|
2 |
+
# os.system('pip3 install openmim')
|
3 |
os.system('mim install mmcv-full==1.7.0')
|
4 |
+
# os.system('pip3 install mmpose')
|
5 |
+
# os.system('pip3 install mmdet')
|
6 |
+
# os.system('pip3 install gradio==3.19.1')
|
7 |
|
8 |
from demo.model import Model_all
|
9 |
import gradio as gr
|
|
|
64 |
|
65 |
# demo.queue(api_open=False).launch(server_name='0.0.0.0')
|
66 |
# demo.queue(show_api=False, enable_queue=False).launch(server_name='0.0.0.0')
|
67 |
+
demo.queue().launch(debug=True, server_name='0.0.0.0')
|
demo/demos.py
CHANGED
@@ -1,18 +1,9 @@
|
|
1 |
import gradio as gr
|
2 |
import numpy as np
|
3 |
-
import psutil
|
4 |
|
5 |
def create_map():
|
6 |
return np.zeros(shape=(512, 1024), dtype=np.uint8)+255
|
7 |
|
8 |
-
def get_system_memory():
|
9 |
-
memory = psutil.virtual_memory()
|
10 |
-
memory_percent = memory.percent
|
11 |
-
memory_used = memory.used / (1024.0 ** 3)
|
12 |
-
memory_total = memory.total / (1024.0 ** 3)
|
13 |
-
return {"percent": f"{memory_percent}%", "used": f"{memory_used:.3f}GB", "total": f"{memory_total:.3f}GB"}
|
14 |
-
|
15 |
-
|
16 |
|
17 |
def create_demo_keypose(process):
|
18 |
with gr.Blocks() as demo:
|
@@ -43,13 +34,6 @@ def create_demo_sketch(process):
|
|
43 |
with gr.Blocks() as demo:
|
44 |
with gr.Row():
|
45 |
gr.Markdown('T2I-Adapter (Sketch)')
|
46 |
-
|
47 |
-
with gr.Row():
|
48 |
-
with gr.Column():
|
49 |
-
gr.Textbox(value="Hello Memory")
|
50 |
-
with gr.Column():
|
51 |
-
gr.JSON(get_system_memory, every=1)
|
52 |
-
|
53 |
with gr.Row():
|
54 |
with gr.Column():
|
55 |
input_img = gr.Image(source='upload', type="numpy")
|
@@ -80,7 +64,7 @@ def create_demo_draw(process):
|
|
80 |
with gr.Column():
|
81 |
create_button = gr.Button(label="Start", value='Hand-free drawing')
|
82 |
input_img = gr.Image(source='upload', type="numpy",tool='sketch')
|
83 |
-
create_button.click(fn=create_map, outputs=[input_img])
|
84 |
prompt = gr.Textbox(label="Prompt")
|
85 |
neg_prompt = gr.Textbox(label="Negative Prompt",
|
86 |
value='ugly, tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, extra limbs, disfigured, deformed, body out of frame, bad anatomy, watermark, signature, cut off, low contrast, underexposed, overexposed, bad art, beginner, amateur, distorted face')
|
|
|
1 |
import gradio as gr
|
2 |
import numpy as np
|
|
|
3 |
|
4 |
def create_map():
|
5 |
return np.zeros(shape=(512, 1024), dtype=np.uint8)+255
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
def create_demo_keypose(process):
|
9 |
with gr.Blocks() as demo:
|
|
|
34 |
with gr.Blocks() as demo:
|
35 |
with gr.Row():
|
36 |
gr.Markdown('T2I-Adapter (Sketch)')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
with gr.Row():
|
38 |
with gr.Column():
|
39 |
input_img = gr.Image(source='upload', type="numpy")
|
|
|
64 |
with gr.Column():
|
65 |
create_button = gr.Button(label="Start", value='Hand-free drawing')
|
66 |
input_img = gr.Image(source='upload', type="numpy",tool='sketch')
|
67 |
+
create_button.click(fn=create_map, outputs=[input_img], queue=False)
|
68 |
prompt = gr.Textbox(label="Prompt")
|
69 |
neg_prompt = gr.Textbox(label="Negative Prompt",
|
70 |
value='ugly, tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, extra limbs, disfigured, deformed, body out of frame, bad anatomy, watermark, signature, cut off, low contrast, underexposed, overexposed, bad art, beginner, amateur, distorted face')
|
requirements.txt
CHANGED
@@ -9,4 +9,10 @@ omegaconf==2.3.0
|
|
9 |
taming-transformers-rom1504==0.0.6
|
10 |
pytorch_lightning==1.8.6
|
11 |
clip==0.2.0
|
12 |
-
kornia==0.6.8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
taming-transformers-rom1504==0.0.6
|
10 |
pytorch_lightning==1.8.6
|
11 |
clip==0.2.0
|
12 |
+
kornia==0.6.8
|
13 |
+
|
14 |
+
|
15 |
+
openmim
|
16 |
+
mmpose
|
17 |
+
mmdet
|
18 |
+
psutil
|