Update app.py
Browse files
app.py
CHANGED
@@ -29,8 +29,7 @@ def flip_image(x):
|
|
29 |
|
30 |
def clear():
|
31 |
return None
|
32 |
-
|
33 |
-
return gr.Tabs.update(selected=1)
|
34 |
|
35 |
# Function to query the API and return the generated image
|
36 |
def query(prompt, is_negative=False, steps=35, cfg_scale=7, sampler="DPM++ 2M Karras", seed=-1, strength=0.7, width=896, height=1152):
|
@@ -160,7 +159,7 @@ with gr.Blocks(theme=theme, css=css) as app:
|
|
160 |
# Add a title to the app
|
161 |
gr.HTML("<center><h1>🎨 Stable Diffusion 3.5 Large Turbo + 🇬🇧</h1></center>")
|
162 |
with gr.Tabs() as tabs:
|
163 |
-
with gr.TabItem(label="Image To Prompt", visible=True
|
164 |
with gr.Row():
|
165 |
with gr.Column():
|
166 |
input_img = gr.Image(label="Input Picture 🖼️",height=320,type="filepath")
|
@@ -172,7 +171,7 @@ with gr.Blocks(theme=theme, css=css) as app:
|
|
172 |
|
173 |
submit_btn.click(feifeichat, [input_img], [output_text])
|
174 |
|
175 |
-
with gr.TabItem("Text to Image", visible=True
|
176 |
# Container for all the UI elements
|
177 |
with gr.Column(elem_id="app-container"):
|
178 |
# Add a text input for the main prompt
|
@@ -220,7 +219,7 @@ with gr.Blocks(theme=theme, css=css) as app:
|
|
220 |
text_button.click(query, inputs=[text_prompt, negative_prompt, steps, cfg, method, seed, strength, width, height], outputs=image_output)
|
221 |
|
222 |
|
223 |
-
with gr.TabItem("🔄 Flip Image", visible=True
|
224 |
with gr.Row():
|
225 |
image_input = gr.Image(label="Upload Image", height=320, type="filepath")
|
226 |
image_output = gr.Image(format="png")
|
@@ -231,7 +230,7 @@ with gr.Blocks(theme=theme, css=css) as app:
|
|
231 |
clear_results = gr.Button(value="Clear Image", variant="primary", elem_id="clear_button")
|
232 |
clear_results.click(lambda: (None, None), None, [image_input, image_output])
|
233 |
|
234 |
-
with gr.TabItem("ℹ️ Tips", visible=True
|
235 |
with gr.Row():
|
236 |
with gr.Column():
|
237 |
gr.Markdown(
|
|
|
29 |
|
30 |
def clear():
|
31 |
return None
|
32 |
+
|
|
|
33 |
|
34 |
# Function to query the API and return the generated image
|
35 |
def query(prompt, is_negative=False, steps=35, cfg_scale=7, sampler="DPM++ 2M Karras", seed=-1, strength=0.7, width=896, height=1152):
|
|
|
159 |
# Add a title to the app
|
160 |
gr.HTML("<center><h1>🎨 Stable Diffusion 3.5 Large Turbo + 🇬🇧</h1></center>")
|
161 |
with gr.Tabs() as tabs:
|
162 |
+
with gr.TabItem(label="Image To Prompt", visible=True):
|
163 |
with gr.Row():
|
164 |
with gr.Column():
|
165 |
input_img = gr.Image(label="Input Picture 🖼️",height=320,type="filepath")
|
|
|
171 |
|
172 |
submit_btn.click(feifeichat, [input_img], [output_text])
|
173 |
|
174 |
+
with gr.TabItem("Text to Image", visible=True):
|
175 |
# Container for all the UI elements
|
176 |
with gr.Column(elem_id="app-container"):
|
177 |
# Add a text input for the main prompt
|
|
|
219 |
text_button.click(query, inputs=[text_prompt, negative_prompt, steps, cfg, method, seed, strength, width, height], outputs=image_output)
|
220 |
|
221 |
|
222 |
+
with gr.TabItem("🔄 Flip Image", visible=True):
|
223 |
with gr.Row():
|
224 |
image_input = gr.Image(label="Upload Image", height=320, type="filepath")
|
225 |
image_output = gr.Image(format="png")
|
|
|
230 |
clear_results = gr.Button(value="Clear Image", variant="primary", elem_id="clear_button")
|
231 |
clear_results.click(lambda: (None, None), None, [image_input, image_output])
|
232 |
|
233 |
+
with gr.TabItem("ℹ️ Tips", visible=True):
|
234 |
with gr.Row():
|
235 |
with gr.Column():
|
236 |
gr.Markdown(
|