Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -48,11 +48,7 @@ inputs.append(gr.Number(
|
|
48 |
names = ['prompt', 'negative_prompt', 'subject', 'number_of_outputs', 'number_of_images_per_pose', 'randomise_poses', 'output_format', 'output_quality', 'seed']
|
49 |
|
50 |
outputs = []
|
51 |
-
outputs.append(gr.
|
52 |
-
outputs.append(gr.Image())
|
53 |
-
outputs.append(gr.Image())
|
54 |
-
outputs.append(gr.Image())
|
55 |
-
outputs.append(gr.Image())
|
56 |
|
57 |
expected_outputs = len(outputs)
|
58 |
def predict(request: gr.Request, *args, progress=gr.Progress(track_tqdm=True)):
|
@@ -88,13 +84,7 @@ def predict(request: gr.Request, *args, progress=gr.Progress(track_tqdm=True)):
|
|
88 |
predict_outputs = parse_outputs(json_response["output"])
|
89 |
processed_outputs = process_outputs(predict_outputs)
|
90 |
difference_outputs = expected_outputs - len(processed_outputs)
|
91 |
-
|
92 |
-
if difference_outputs > 0:
|
93 |
-
extra_outputs = [gr.update(visible=False)] * difference_outputs
|
94 |
-
processed_outputs.extend(extra_outputs)
|
95 |
-
# If more outputs than expected, cap the outputs to the expected number
|
96 |
-
elif difference_outputs < 0:
|
97 |
-
processed_outputs = processed_outputs[:difference_outputs]
|
98 |
|
99 |
return tuple(processed_outputs) if len(processed_outputs) > 1 else processed_outputs[0]
|
100 |
else:
|
@@ -113,5 +103,5 @@ app = gr.Interface(
|
|
113 |
description=model_description,
|
114 |
allow_flagging="never",
|
115 |
)
|
116 |
-
app.launch(share=
|
117 |
|
|
|
48 |
names = ['prompt', 'negative_prompt', 'subject', 'number_of_outputs', 'number_of_images_per_pose', 'randomise_poses', 'output_format', 'output_quality', 'seed']
|
49 |
|
50 |
outputs = []
|
51 |
+
outputs.append(gr.Gallery())
|
|
|
|
|
|
|
|
|
52 |
|
53 |
expected_outputs = len(outputs)
|
54 |
def predict(request: gr.Request, *args, progress=gr.Progress(track_tqdm=True)):
|
|
|
84 |
predict_outputs = parse_outputs(json_response["output"])
|
85 |
processed_outputs = process_outputs(predict_outputs)
|
86 |
difference_outputs = expected_outputs - len(processed_outputs)
|
87 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
|
89 |
return tuple(processed_outputs) if len(processed_outputs) > 1 else processed_outputs[0]
|
90 |
else:
|
|
|
103 |
description=model_description,
|
104 |
allow_flagging="never",
|
105 |
)
|
106 |
+
app.launch(share=False)
|
107 |
|