Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -67,7 +67,6 @@ def image_to_base64(image_path):
|
|
67 |
img_str = base64.b64encode(buffered.getvalue())
|
68 |
return img_str.decode('utf-8')
|
69 |
|
70 |
-
# Ensure that the API key is available
|
71 |
api_key = os.getenv("PRODIA_API_KEY")
|
72 |
if not api_key:
|
73 |
raise ValueError("Prodia API key not found in environment variables")
|
@@ -160,6 +159,9 @@ body {
|
|
160 |
with gr.Blocks(css=css) as demo:
|
161 |
state = gr.State(value="Welcome Screen")
|
162 |
|
|
|
|
|
|
|
163 |
with gr.Tabs() as tabs:
|
164 |
with gr.TabItem("Welcome Screen"):
|
165 |
with gr.Row():
|
@@ -228,7 +230,7 @@ with gr.Blocks(css=css) as demo:
|
|
228 |
|
229 |
text_button.click(flip_text, inputs=[prompt, negative_prompt, model, steps, sampler, cfg_scale, width, height, seed], outputs=image_output)
|
230 |
start_button.click(fn=lambda: "Main Generation Screen", inputs=None, outputs=state)
|
231 |
-
state.change(fn=
|
232 |
|
233 |
# Launch the Gradio app
|
234 |
demo.launch(max_threads=128)
|
|
|
67 |
img_str = base64.b64encode(buffered.getvalue())
|
68 |
return img_str.decode('utf-8')
|
69 |
|
|
|
70 |
api_key = os.getenv("PRODIA_API_KEY")
|
71 |
if not api_key:
|
72 |
raise ValueError("Prodia API key not found in environment variables")
|
|
|
159 |
with gr.Blocks(css=css) as demo:
|
160 |
state = gr.State(value="Welcome Screen")
|
161 |
|
162 |
+
def update_visibility(tab_state):
|
163 |
+
return gr.Tabs.update(visible=(tab_state == "Main Generation Screen"))
|
164 |
+
|
165 |
with gr.Tabs() as tabs:
|
166 |
with gr.TabItem("Welcome Screen"):
|
167 |
with gr.Row():
|
|
|
230 |
|
231 |
text_button.click(flip_text, inputs=[prompt, negative_prompt, model, steps, sampler, cfg_scale, width, height, seed], outputs=image_output)
|
232 |
start_button.click(fn=lambda: "Main Generation Screen", inputs=None, outputs=state)
|
233 |
+
state.change(fn=update_visibility, inputs=state, outputs=tabs)
|
234 |
|
235 |
# Launch the Gradio app
|
236 |
demo.launch(max_threads=128)
|