fffiloni commited on
Commit
2ea2166
1 Parent(s): ceb312c

switch to gradio Blocks mode

Browse files
Files changed (1) hide show
  1. app.py +31 -15
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.Interface(
83
- fn=run,
84
- inputs=[
85
- gr.Image(type="filepath", value="./example_image/medieval-bed.jpeg"),
86
- gr.Textbox(value="medieval painting"),
87
- gr.Textbox(value="Man laying on bed"),
88
- gr.Textbox(value="A man working on a laptop"),
89
- gr.Textbox(value="A man eating pizza"),
90
- gr.Textbox(value="A woman playing on saxophone")
91
- ],
92
- outputs=[
93
- gr.Gallery()
94
- ],
95
- title="Google's Style Aligned Transfer"
96
- ).launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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()