Spaces:
Running
Running
memory debug
Browse files
app.py
CHANGED
@@ -32,6 +32,18 @@ pipe.enable_model_cpu_offload()
|
|
32 |
canny = CannyDetector()
|
33 |
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
@spaces.GPU(duration=160)
|
36 |
def inpaint(
|
37 |
image,
|
@@ -60,6 +72,11 @@ def inpaint(
|
|
60 |
|
61 |
with gr.Blocks() as demo:
|
62 |
# gr.LoginButton()
|
|
|
|
|
|
|
|
|
|
|
63 |
gr.Interface(
|
64 |
fn=inpaint,
|
65 |
inputs=[
|
@@ -76,7 +93,7 @@ with gr.Blocks() as demo:
|
|
76 |
description="Upload an image and a mask, then provide a prompt to generate an inpainted image.",
|
77 |
)
|
78 |
|
79 |
-
demo.launch()
|
80 |
|
81 |
# import gradio as gr
|
82 |
# import numpy as np
|
|
|
32 |
canny = CannyDetector()
|
33 |
|
34 |
|
35 |
+
def get_system_memory():
|
36 |
+
memory = psutil.virtual_memory()
|
37 |
+
memory_percent = memory.percent
|
38 |
+
memory_used = memory.used / (1024.0**3)
|
39 |
+
memory_total = memory.total / (1024.0**3)
|
40 |
+
return {
|
41 |
+
"percent": f"{memory_percent}%",
|
42 |
+
"used": f"{memory_used:.3f}GB",
|
43 |
+
"total": f"{memory_total:.3f}GB",
|
44 |
+
}
|
45 |
+
|
46 |
+
|
47 |
@spaces.GPU(duration=160)
|
48 |
def inpaint(
|
49 |
image,
|
|
|
72 |
|
73 |
with gr.Blocks() as demo:
|
74 |
# gr.LoginButton()
|
75 |
+
with gr.Row():
|
76 |
+
with gr.Column():
|
77 |
+
gr.Textbox(value="Hello Memory")
|
78 |
+
with gr.Column():
|
79 |
+
gr.JSON(get_system_memory, every=1)
|
80 |
gr.Interface(
|
81 |
fn=inpaint,
|
82 |
inputs=[
|
|
|
93 |
description="Upload an image and a mask, then provide a prompt to generate an inpainted image.",
|
94 |
)
|
95 |
|
96 |
+
demo.launch(debug=True)
|
97 |
|
98 |
# import gradio as gr
|
99 |
# import numpy as np
|