Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -26,20 +26,25 @@ def generate_images(prompt, num_inference_steps, guidance_scale, batch_size):
|
|
26 |
# Define Gradio interface
|
27 |
def get_cpu_info():
|
28 |
cpu_name = psutil.cpu_freq().brand
|
29 |
-
memory_available = psutil.virtual_memory().available // 1024 // 1024
|
30 |
return f"CPU: {cpu_name}, Memory: {memory_available} MB"
|
31 |
|
|
|
|
|
32 |
iface = gr.Interface(
|
33 |
fn=generate_images,
|
34 |
inputs=[
|
35 |
gr.Textbox(label="Prompt"),
|
|
|
36 |
gr.Slider(label="Guidance Scale", minimum=0, maximum=20, step=0.1, value=0),
|
37 |
gr.Slider(label="Batch Size", minimum=1, maximum=4, step=1, value=1),
|
38 |
],
|
39 |
-
outputs=
|
|
|
|
|
|
|
40 |
title="SDXL Lightning 4-Step Inference (CPU)",
|
41 |
description="Generate images with Stable Diffusion XL Lightning 4-Step model on CPU.",
|
42 |
-
extra_info=get_cpu_info,
|
43 |
)
|
44 |
|
45 |
iface.launch()
|
|
|
26 |
# Define Gradio interface
|
27 |
def get_cpu_info():
|
28 |
cpu_name = psutil.cpu_freq().brand
|
29 |
+
memory_available = psutil.virtual_memory().available // 1024 // 1024 # in MB
|
30 |
return f"CPU: {cpu_name}, Memory: {memory_available} MB"
|
31 |
|
32 |
+
cpu_info_text = gr.Textbox(label="CPU Information", value=get_cpu_info(), interactive=False)
|
33 |
+
|
34 |
iface = gr.Interface(
|
35 |
fn=generate_images,
|
36 |
inputs=[
|
37 |
gr.Textbox(label="Prompt"),
|
38 |
+
gr.Slider(label="Num Inference Steps", minimum=1, maximum=50, step=1, value=4),
|
39 |
gr.Slider(label="Guidance Scale", minimum=0, maximum=20, step=0.1, value=0),
|
40 |
gr.Slider(label="Batch Size", minimum=1, maximum=4, step=1, value=1),
|
41 |
],
|
42 |
+
outputs=[
|
43 |
+
gr.Gallery(label="Generated Images"),
|
44 |
+
cpu_info_text
|
45 |
+
],
|
46 |
title="SDXL Lightning 4-Step Inference (CPU)",
|
47 |
description="Generate images with Stable Diffusion XL Lightning 4-Step model on CPU.",
|
|
|
48 |
)
|
49 |
|
50 |
iface.launch()
|