Spaces:
Running
on
Zero
Running
on
Zero
alex
commited on
Commit
·
0ab8ba2
1
Parent(s):
0c48712
simplify duplication when no token given
Browse files
app.py
CHANGED
|
@@ -104,7 +104,14 @@ print(f"loading model...")
|
|
| 104 |
DEFAULT_CONFIG['cpu_offload'] = enable_cpu_offload # always use cpu offload if image generation is enabled
|
| 105 |
DEFAULT_CONFIG['mode'] = "t2v" # hardcoded since it is always cpu offloaded
|
| 106 |
ovi_engine = OviFusionEngine()
|
| 107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
print("loaded model")
|
| 109 |
|
| 110 |
|
|
@@ -183,6 +190,9 @@ def generate_scene(
|
|
| 183 |
if not text_prompt_processed:
|
| 184 |
raise gr.Error("Please enter a prompt.")
|
| 185 |
|
|
|
|
|
|
|
|
|
|
| 186 |
if session_id is None:
|
| 187 |
session_id = uuid.uuid4().hex
|
| 188 |
|
|
@@ -390,7 +400,7 @@ with gr.Blocks(css=css, theme=theme) as demo:
|
|
| 390 |
[
|
| 391 |
"The video opens with a close-up of a woman with vibrant reddish-orange, shoulder-length hair and heavy dark eye makeup. She is wearing a dark brown leather jacket over a grey hooded top. She looks intently to her right, her mouth slightly agape, and her expression is serious and focused. The background shows a room with light green walls and dark wooden cabinets on the left, and a green plant on the right. She speaks, her voice clear and direct, saying, <S>doing<E>. She then pauses briefly, her gaze unwavering, and continues, <S>And I need you to trust them.<E>. Her mouth remains slightly open, indicating she is either about to speak more or has just finished a sentence, with a look of intense sincerity.. <AUDCAP>Tense, dramatic background music, clear female voice.<ENDAUDCAP>",
|
| 392 |
50,
|
| 393 |
-
|
| 394 |
],
|
| 395 |
|
| 396 |
[
|
|
|
|
| 104 |
DEFAULT_CONFIG['cpu_offload'] = enable_cpu_offload # always use cpu offload if image generation is enabled
|
| 105 |
DEFAULT_CONFIG['mode'] = "t2v" # hardcoded since it is always cpu offloaded
|
| 106 |
ovi_engine = OviFusionEngine()
|
| 107 |
+
|
| 108 |
+
try:
|
| 109 |
+
flux_model = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-Krea-dev", torch_dtype=torch.bfloat16)
|
| 110 |
+
image_example = None
|
| 111 |
+
except Exception as e:
|
| 112 |
+
flux_model = None
|
| 113 |
+
image_example = "example_prompts/pngs/8.png"
|
| 114 |
+
|
| 115 |
print("loaded model")
|
| 116 |
|
| 117 |
|
|
|
|
| 190 |
if not text_prompt_processed:
|
| 191 |
raise gr.Error("Please enter a prompt.")
|
| 192 |
|
| 193 |
+
if not flux_model and not image:
|
| 194 |
+
raise gr.Error("Please provide an image")
|
| 195 |
+
|
| 196 |
if session_id is None:
|
| 197 |
session_id = uuid.uuid4().hex
|
| 198 |
|
|
|
|
| 400 |
[
|
| 401 |
"The video opens with a close-up of a woman with vibrant reddish-orange, shoulder-length hair and heavy dark eye makeup. She is wearing a dark brown leather jacket over a grey hooded top. She looks intently to her right, her mouth slightly agape, and her expression is serious and focused. The background shows a room with light green walls and dark wooden cabinets on the left, and a green plant on the right. She speaks, her voice clear and direct, saying, <S>doing<E>. She then pauses briefly, her gaze unwavering, and continues, <S>And I need you to trust them.<E>. Her mouth remains slightly open, indicating she is either about to speak more or has just finished a sentence, with a look of intense sincerity.. <AUDCAP>Tense, dramatic background music, clear female voice.<ENDAUDCAP>",
|
| 402 |
50,
|
| 403 |
+
f"{image_example}",
|
| 404 |
],
|
| 405 |
|
| 406 |
[
|