Spaces:
Running
on
Zero
Running
on
Zero
switch to gradio Blocks mode
Browse files
app.py
CHANGED
|
@@ -79,18 +79,34 @@ def run(ref_path, ref_style, ref_prompt, prompt1, prompt2, prompt3):
|
|
| 79 |
|
| 80 |
return images_a
|
| 81 |
|
| 82 |
-
gr.
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
gr.
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
return images_a
|
| 81 |
|
| 82 |
+
with gr.Blocks() as demo:
|
| 83 |
+
with gr. Column():
|
| 84 |
+
gr.HTML("""
|
| 85 |
+
<h2 style="text-align: center;">Google's StyleAligned Transfer</h2>
|
| 86 |
+
"""
|
| 87 |
+
)
|
| 88 |
+
with gr.Row():
|
| 89 |
+
with gr.Column():
|
| 90 |
+
ref_path = gr.Image(type="filepath", value="./example_image/medieval-bed.jpeg")
|
| 91 |
+
with gr.Column():
|
| 92 |
+
ref_style = gr.Textbox(value="medieval painting")
|
| 93 |
+
ref_prompt = gr.Textbox(value="Man laying on bed")
|
| 94 |
+
prompt1 = gr.Textbox(value="A man working on a laptop")
|
| 95 |
+
prompt2 = gr.Textbox(value="A man eating pizza")
|
| 96 |
+
prompt3 = gr.Textbox(value="A woman playing on saxophone")
|
| 97 |
+
run_button = gr.Button("Submit")
|
| 98 |
+
with gr.Column():
|
| 99 |
+
results = gr.Gallery()
|
| 100 |
+
|
| 101 |
+
run_button.click(
|
| 102 |
+
fn = run,
|
| 103 |
+
inputs = [
|
| 104 |
+
ref_path, ref_style, ref_prompt,
|
| 105 |
+
prompt1, prompt2, prompt3
|
| 106 |
+
],
|
| 107 |
+
outputs = [
|
| 108 |
+
results
|
| 109 |
+
]
|
| 110 |
+
)
|
| 111 |
+
|
| 112 |
+
demo.queue().launch()
|