Spaces:
Runtime error
Runtime error
feat: Fix selected space loading in app.py
Browse filesThis commit fixes the loading of the selected space in the `infer` function of `app.py`. Previously, the code was not properly handling the case when the selected space failed to load. The updated code now attempts to load the next available space from the list of spaces until a successful load is achieved. This ensures that the model is properly loaded and prevents any errors from occurring during inference.
app.py
CHANGED
@@ -12,7 +12,6 @@ flux_1_schell_spaces = ["https://black-forest-labs-flux-1-schnell.hf.space", "Ch
|
|
12 |
client = None
|
13 |
job = None
|
14 |
|
15 |
-
selected_space_index = gr.State(0);
|
16 |
|
17 |
def infer(selected_space_index, prompt, seed=42, randomize_seed=False, width=1024, height=1024, num_inference_steps=4, progress=gr.Progress(track_tqdm=True)):
|
18 |
global job
|
@@ -68,6 +67,7 @@ css="""
|
|
68 |
"""
|
69 |
|
70 |
with gr.Blocks(css=css) as demo:
|
|
|
71 |
|
72 |
with gr.Column(elem_id="col-container"):
|
73 |
gr.Markdown(f"""# FLUX.1 [schnell]
|
|
|
12 |
client = None
|
13 |
job = None
|
14 |
|
|
|
15 |
|
16 |
def infer(selected_space_index, prompt, seed=42, randomize_seed=False, width=1024, height=1024, num_inference_steps=4, progress=gr.Progress(track_tqdm=True)):
|
17 |
global job
|
|
|
67 |
"""
|
68 |
|
69 |
with gr.Blocks(css=css) as demo:
|
70 |
+
selected_space_index = gr.State(0);
|
71 |
|
72 |
with gr.Column(elem_id="col-container"):
|
73 |
gr.Markdown(f"""# FLUX.1 [schnell]
|