Update app.py
Browse files
app.py
CHANGED
@@ -26,7 +26,8 @@ Mistralclient = Mistral(api_key=api_key)
|
|
26 |
|
27 |
def clear():
|
28 |
return None
|
29 |
-
|
|
|
30 |
|
31 |
# Function to query the API and return the generated image
|
32 |
def query(prompt, is_negative=False, steps=35, cfg_scale=7, sampler="DPM++ 2M Karras", seed=-1, strength=0.7, width=896, height=1152):
|
@@ -156,7 +157,7 @@ with gr.Blocks(theme=theme, css=css) as app:
|
|
156 |
# Add a title to the app
|
157 |
gr.HTML("<center><h1>π¨ Stable Diffusion 3.5 large turbo π¬π§</h1></center>")
|
158 |
with gr.Tabs() as tabs:
|
159 |
-
with gr.TabItem("Text to Image"):
|
160 |
# Container for all the UI elements
|
161 |
with gr.Column(elem_id="app-container"):
|
162 |
# Add a text input for the main prompt
|
@@ -201,7 +202,7 @@ with gr.Blocks(theme=theme, css=css) as app:
|
|
201 |
# Bind the button to the query function with the added width and height inputs
|
202 |
text_button.click(query, inputs=[text_prompt, negative_prompt, steps, cfg, method, seed, strength, width, height], outputs=image_output)
|
203 |
|
204 |
-
with gr.TabItem(label="Image To Prompt", visible=True):
|
205 |
with gr.Row():
|
206 |
with gr.Column():
|
207 |
input_img = gr.Image(label="Input Picture",height=320,type="filepath")
|
|
|
26 |
|
27 |
def clear():
|
28 |
return None
|
29 |
+
def change_tab():
|
30 |
+
return gr.Tabs.update(selected=1)
|
31 |
|
32 |
# Function to query the API and return the generated image
|
33 |
def query(prompt, is_negative=False, steps=35, cfg_scale=7, sampler="DPM++ 2M Karras", seed=-1, strength=0.7, width=896, height=1152):
|
|
|
157 |
# Add a title to the app
|
158 |
gr.HTML("<center><h1>π¨ Stable Diffusion 3.5 large turbo π¬π§</h1></center>")
|
159 |
with gr.Tabs() as tabs:
|
160 |
+
with gr.TabItem("Text to Image", id=0):
|
161 |
# Container for all the UI elements
|
162 |
with gr.Column(elem_id="app-container"):
|
163 |
# Add a text input for the main prompt
|
|
|
202 |
# Bind the button to the query function with the added width and height inputs
|
203 |
text_button.click(query, inputs=[text_prompt, negative_prompt, steps, cfg, method, seed, strength, width, height], outputs=image_output)
|
204 |
|
205 |
+
with gr.TabItem(label="Image To Prompt", visible=True, id=1):
|
206 |
with gr.Row():
|
207 |
with gr.Column():
|
208 |
input_img = gr.Image(label="Input Picture",height=320,type="filepath")
|