Spaces:
Paused
Paused
Upload app_vince.py
Browse files- app_vince.py +8 -8
app_vince.py
CHANGED
|
@@ -33,7 +33,7 @@ def _list_media(out_dir: Path, max_images: int = 24) -> Tuple[List[str], Optiona
|
|
| 33 |
def ui_multi_turn(
|
| 34 |
input_image: Optional[str],
|
| 35 |
turns_text: Optional[str],
|
| 36 |
-
|
| 37 |
cfg_scale_input: float,
|
| 38 |
aspect_ratio_input: str,
|
| 39 |
resolution_input: int,
|
|
@@ -54,7 +54,7 @@ def ui_multi_turn(
|
|
| 54 |
cfg_scale=float(cfg_scale_input) if cfg_scale_input is not None else None,
|
| 55 |
aspect_ratio=str(aspect_ratio_input) if aspect_ratio_input else None,
|
| 56 |
resolution=int(resolution_input) if resolution_input is not None else None,
|
| 57 |
-
steps=int(
|
| 58 |
)
|
| 59 |
except Exception as e:
|
| 60 |
print(f"[multi_turn] erro: {e}")
|
|
@@ -74,7 +74,7 @@ def ui_multi_concept(
|
|
| 74 |
files: Optional[List[str]],
|
| 75 |
descs_text: Optional[str],
|
| 76 |
final_prompt: Optional[str],
|
| 77 |
-
|
| 78 |
cfg_scale_input: float,
|
| 79 |
aspect_ratio_input: str,
|
| 80 |
resolution_input: int,
|
|
@@ -102,7 +102,7 @@ def ui_multi_concept(
|
|
| 102 |
cfg_scale=float(cfg_scale_input) if cfg_scale_input is not None else None,
|
| 103 |
aspect_ratio=str(aspect_ratio_input) if aspect_ratio_input else None,
|
| 104 |
resolution=int(resolution_input) if resolution_input is not None else None,
|
| 105 |
-
steps=int(
|
| 106 |
pad_placeholder=False,
|
| 107 |
)
|
| 108 |
except Exception as e:
|
|
@@ -140,7 +140,7 @@ with gr.Blocks(title="VINCIE 🎨") as demo:
|
|
| 140 |
#out_video = gr.Video(label="Vídeo (se houver)")
|
| 141 |
run1.click(
|
| 142 |
ui_multi_turn,
|
| 143 |
-
inputs=[img, turns, cfg_scale_input, aspect_ratio_input, resolution_input],
|
| 144 |
outputs=[out_gallery],
|
| 145 |
)
|
| 146 |
|
|
@@ -155,13 +155,13 @@ with gr.Blocks(title="VINCIE 🎨") as demo:
|
|
| 155 |
#out_video2 = gr.Video(label="Vídeo (se houver)")
|
| 156 |
run2.click(
|
| 157 |
ui_multi_concept,
|
| 158 |
-
inputs=[files, descs, final_prompt, cfg_scale_input, aspect_ratio_input, resolution_input],
|
| 159 |
outputs=[out_gallery2],
|
| 160 |
)
|
| 161 |
|
| 162 |
# Opções Avançadas
|
| 163 |
with gr.Accordion("Opções Avançadas", open=False):
|
| 164 |
-
|
| 165 |
cfg_scale_input = gr.Slider(label="Escala de Orientação (CFG)", minimum=1.0, maximum=15.0, step=0.5, value=7.5)
|
| 166 |
aspect_ratio_input = gr.Dropdown(
|
| 167 |
label="Aspect Ratio",
|
|
@@ -175,6 +175,6 @@ if __name__ == "__main__":
|
|
| 175 |
demo.launch(
|
| 176 |
server_name=os.getenv("GRADIO_SERVER_NAME", "0.0.0.0"),
|
| 177 |
server_port=int(os.getenv("GRADIO_SERVER_PORT", os.getenv("PORT", "7860"))),
|
| 178 |
-
allowed_paths=["/app/outputs", "/
|
| 179 |
show_error=True,
|
| 180 |
)
|
|
|
|
| 33 |
def ui_multi_turn(
|
| 34 |
input_image: Optional[str],
|
| 35 |
turns_text: Optional[str],
|
| 36 |
+
steps_input: int,
|
| 37 |
cfg_scale_input: float,
|
| 38 |
aspect_ratio_input: str,
|
| 39 |
resolution_input: int,
|
|
|
|
| 54 |
cfg_scale=float(cfg_scale_input) if cfg_scale_input is not None else None,
|
| 55 |
aspect_ratio=str(aspect_ratio_input) if aspect_ratio_input else None,
|
| 56 |
resolution=int(resolution_input) if resolution_input is not None else None,
|
| 57 |
+
steps=int(steps_input) if steps_input is not None else None,
|
| 58 |
)
|
| 59 |
except Exception as e:
|
| 60 |
print(f"[multi_turn] erro: {e}")
|
|
|
|
| 74 |
files: Optional[List[str]],
|
| 75 |
descs_text: Optional[str],
|
| 76 |
final_prompt: Optional[str],
|
| 77 |
+
steps_input: int,
|
| 78 |
cfg_scale_input: float,
|
| 79 |
aspect_ratio_input: str,
|
| 80 |
resolution_input: int,
|
|
|
|
| 102 |
cfg_scale=float(cfg_scale_input) if cfg_scale_input is not None else None,
|
| 103 |
aspect_ratio=str(aspect_ratio_input) if aspect_ratio_input else None,
|
| 104 |
resolution=int(resolution_input) if resolution_input is not None else None,
|
| 105 |
+
steps=int(steps_input) if steps_input is not None else None,
|
| 106 |
pad_placeholder=False,
|
| 107 |
)
|
| 108 |
except Exception as e:
|
|
|
|
| 140 |
#out_video = gr.Video(label="Vídeo (se houver)")
|
| 141 |
run1.click(
|
| 142 |
ui_multi_turn,
|
| 143 |
+
inputs=[img, turns, steps_input, cfg_scale_input, aspect_ratio_input, resolution_input],
|
| 144 |
outputs=[out_gallery],
|
| 145 |
)
|
| 146 |
|
|
|
|
| 155 |
#out_video2 = gr.Video(label="Vídeo (se houver)")
|
| 156 |
run2.click(
|
| 157 |
ui_multi_concept,
|
| 158 |
+
inputs=[files, descs, final_prompt, steps_input, cfg_scale_input, aspect_ratio_input, resolution_input],
|
| 159 |
outputs=[out_gallery2],
|
| 160 |
)
|
| 161 |
|
| 162 |
# Opções Avançadas
|
| 163 |
with gr.Accordion("Opções Avançadas", open=False):
|
| 164 |
+
steps_input = gr.Slider(label="Passos de Inferência", minimum=10, maximum=100, step=1, value=50)
|
| 165 |
cfg_scale_input = gr.Slider(label="Escala de Orientação (CFG)", minimum=1.0, maximum=15.0, step=0.5, value=7.5)
|
| 166 |
aspect_ratio_input = gr.Dropdown(
|
| 167 |
label="Aspect Ratio",
|
|
|
|
| 175 |
demo.launch(
|
| 176 |
server_name=os.getenv("GRADIO_SERVER_NAME", "0.0.0.0"),
|
| 177 |
server_port=int(os.getenv("GRADIO_SERVER_PORT", os.getenv("PORT", "7860"))),
|
| 178 |
+
allowed_paths=["/app/outputs", "/app/ckpt"],
|
| 179 |
show_error=True,
|
| 180 |
)
|