Spaces:
Runtime error
Runtime error
add memory status back
Browse files- demo/demos.py +15 -0
demo/demos.py
CHANGED
@@ -1,14 +1,29 @@
|
|
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:
|
10 |
with gr.Row():
|
11 |
gr.Markdown('T2I-Adapter (Keypose)')
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
with gr.Row():
|
13 |
with gr.Column():
|
14 |
input_img = gr.Image(source='upload', type="numpy")
|
|
|
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:
|
19 |
with gr.Row():
|
20 |
gr.Markdown('T2I-Adapter (Keypose)')
|
21 |
+
with gr.Row():
|
22 |
+
with gr.Column():
|
23 |
+
gr.Textbox(value="Hello Memory")
|
24 |
+
with gr.Column():
|
25 |
+
gr.JSON(get_system_memory, every=1)
|
26 |
+
|
27 |
with gr.Row():
|
28 |
with gr.Column():
|
29 |
input_img = gr.Image(source='upload', type="numpy")
|