deepkyu
commited on
Commit
·
c3014da
1
Parent(s):
424d3b0
auto lint (autopep8)
Browse files
app.py
CHANGED
|
@@ -10,25 +10,25 @@ if __name__ == "__main__":
|
|
| 10 |
gr.Markdown(Path('docs/header.md').read_text())
|
| 11 |
gr.Markdown(Path('docs/description.md').read_text())
|
| 12 |
with gr.Row():
|
| 13 |
-
with gr.Column(variant='panel',scale=30):
|
| 14 |
|
| 15 |
text = gr.Textbox(label="Input Prompt", max_lines=5, placeholder="Enter your prompt")
|
| 16 |
-
|
| 17 |
with gr.Row().style(equal_height=True):
|
| 18 |
generate_original_button = gr.Button(value="Generate with Original Model", variant="primary")
|
| 19 |
generate_compressed_button = gr.Button(value="Generate with Compressed Model", variant="primary")
|
| 20 |
|
| 21 |
with gr.Accordion("Advanced Settings", open=False):
|
| 22 |
-
negative = gr.Textbox(label=f'Negative Prompt', placeholder=f'Enter aspects to remove (e.g., {"low quality"})')
|
| 23 |
-
with gr.Row():
|
| 24 |
guidance_scale = gr.Slider(label="Guidance Scale", value=7.5, minimum=4, maximum=11, step=0.5)
|
| 25 |
steps = gr.Slider(label="Denoising Steps", value=25, minimum=10, maximum=75, step=5)
|
| 26 |
seed = gr.Slider(0, 999999, label='Random Seed', value=1234, step=1)
|
| 27 |
|
| 28 |
with gr.Tab("Example Prompts"):
|
| 29 |
examples = gr.Examples(examples=example_list, inputs=[text])
|
| 30 |
-
|
| 31 |
-
with gr.Column(variant='panel',scale=35):
|
| 32 |
# Define original model output components
|
| 33 |
gr.Markdown('<h2 align="center">Original Stable Diffusion 1.4</h2>')
|
| 34 |
original_model_output = gr.Image(label="Original Model")
|
|
@@ -36,24 +36,24 @@ if __name__ == "__main__":
|
|
| 36 |
original_model_test_time = gr.Textbox(value="", label="Inference Time (sec)")
|
| 37 |
original_model_error = gr.Markdown()
|
| 38 |
|
| 39 |
-
with gr.Column(variant='panel',scale=35):
|
| 40 |
# Define compressed model output components
|
| 41 |
gr.Markdown('<h2 align="center">Compressed Stable Diffusion (Ours)</h2>')
|
| 42 |
-
compressed_model_output = gr.Image(label="Compressed Model")
|
| 43 |
with gr.Row().style(equal_height=True):
|
| 44 |
compressed_model_test_time = gr.Textbox(value="", label="Inference Time (sec)")
|
| 45 |
compressed_model_error = gr.Markdown()
|
| 46 |
-
|
| 47 |
-
inputs = [text, negative, guidance_scale, steps, seed]
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
|
|
|
|
|
|
| 52 |
generate_original_button.click(servicer.infer_original_model, inputs=inputs, outputs=original_model_outputs)
|
| 53 |
-
|
| 54 |
# Click the generate button for compressed model
|
| 55 |
compressed_model_outputs = [compressed_model_output, compressed_model_error, compressed_model_test_time]
|
| 56 |
-
text.submit(servicer.infer_compressed_model, inputs=inputs, outputs=compressed_model_outputs)
|
| 57 |
generate_compressed_button.click(servicer.infer_compressed_model, inputs=inputs, outputs=compressed_model_outputs)
|
| 58 |
|
| 59 |
gr.Markdown(Path('docs/footer.md').read_text())
|
|
|
|
| 10 |
gr.Markdown(Path('docs/header.md').read_text())
|
| 11 |
gr.Markdown(Path('docs/description.md').read_text())
|
| 12 |
with gr.Row():
|
| 13 |
+
with gr.Column(variant='panel', scale=30):
|
| 14 |
|
| 15 |
text = gr.Textbox(label="Input Prompt", max_lines=5, placeholder="Enter your prompt")
|
| 16 |
+
|
| 17 |
with gr.Row().style(equal_height=True):
|
| 18 |
generate_original_button = gr.Button(value="Generate with Original Model", variant="primary")
|
| 19 |
generate_compressed_button = gr.Button(value="Generate with Compressed Model", variant="primary")
|
| 20 |
|
| 21 |
with gr.Accordion("Advanced Settings", open=False):
|
| 22 |
+
negative = gr.Textbox(label=f'Negative Prompt', placeholder=f'Enter aspects to remove (e.g., {"low quality"})')
|
| 23 |
+
with gr.Row():
|
| 24 |
guidance_scale = gr.Slider(label="Guidance Scale", value=7.5, minimum=4, maximum=11, step=0.5)
|
| 25 |
steps = gr.Slider(label="Denoising Steps", value=25, minimum=10, maximum=75, step=5)
|
| 26 |
seed = gr.Slider(0, 999999, label='Random Seed', value=1234, step=1)
|
| 27 |
|
| 28 |
with gr.Tab("Example Prompts"):
|
| 29 |
examples = gr.Examples(examples=example_list, inputs=[text])
|
| 30 |
+
|
| 31 |
+
with gr.Column(variant='panel', scale=35):
|
| 32 |
# Define original model output components
|
| 33 |
gr.Markdown('<h2 align="center">Original Stable Diffusion 1.4</h2>')
|
| 34 |
original_model_output = gr.Image(label="Original Model")
|
|
|
|
| 36 |
original_model_test_time = gr.Textbox(value="", label="Inference Time (sec)")
|
| 37 |
original_model_error = gr.Markdown()
|
| 38 |
|
| 39 |
+
with gr.Column(variant='panel', scale=35):
|
| 40 |
# Define compressed model output components
|
| 41 |
gr.Markdown('<h2 align="center">Compressed Stable Diffusion (Ours)</h2>')
|
| 42 |
+
compressed_model_output = gr.Image(label="Compressed Model")
|
| 43 |
with gr.Row().style(equal_height=True):
|
| 44 |
compressed_model_test_time = gr.Textbox(value="", label="Inference Time (sec)")
|
| 45 |
compressed_model_error = gr.Markdown()
|
|
|
|
|
|
|
| 46 |
|
| 47 |
+
inputs = [text, negative, guidance_scale, steps, seed]
|
| 48 |
+
|
| 49 |
+
# Click the generate button for original model
|
| 50 |
+
original_model_outputs = [original_model_output, original_model_error, original_model_test_time]
|
| 51 |
+
text.submit(servicer.infer_original_model, inputs=inputs, outputs=original_model_outputs)
|
| 52 |
generate_original_button.click(servicer.infer_original_model, inputs=inputs, outputs=original_model_outputs)
|
| 53 |
+
|
| 54 |
# Click the generate button for compressed model
|
| 55 |
compressed_model_outputs = [compressed_model_output, compressed_model_error, compressed_model_test_time]
|
| 56 |
+
text.submit(servicer.infer_compressed_model, inputs=inputs, outputs=compressed_model_outputs)
|
| 57 |
generate_compressed_button.click(servicer.infer_compressed_model, inputs=inputs, outputs=compressed_model_outputs)
|
| 58 |
|
| 59 |
gr.Markdown(Path('docs/footer.md').read_text())
|