Spaces:
Runtime error
Runtime error
check memory
Browse files- app.py +2 -1
- demo/demos.py +16 -0
app.py
CHANGED
|
@@ -63,4 +63,5 @@ with gr.Blocks(css='style.css') as demo:
|
|
| 63 |
create_demo_draw(model.process_draw)
|
| 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')
|
|
|
|
|
|
| 63 |
create_demo_draw(model.process_draw)
|
| 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)
|
demo/demos.py
CHANGED
|
@@ -1,9 +1,18 @@
|
|
| 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,6 +43,13 @@ def create_demo_sketch(process):
|
|
| 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")
|
|
|
|
| 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 |
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")
|