Spaces:
Running on Zero
Running on Zero
Upload app.py
Browse files57 unmodified lines58596061626364468 unmodified lines533534535536537538539540541213 unmodified lines75575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679757 unmodified lines"1536x672 路 21:9 full": (672, 1536),}DEFAULT_CANVAS = "960x544 路 16:9 fast"EXAMPLE_CANVAS, EXAMPLE_PORTRAIT_CANVAS = "1344x768 路 16:9 full", "768x1024 路 3:4 full"FPS, FRAMES_PER_CHUNK, LATENTS_PER_CHUNK = 24, 17, 5# It is the *snapped* frame count the ceiling has to hold for: 15 s is 360 frames, which rounds up to 362, i.e.# 15.083 s, and is refused. 14 is the last whole second that survives the snap.468 unmodified linesdef generate(# The first four are the columns `gr.Examples` varies, and they lead the signature for that reason: an example row# is applied to `inputs` positionally. Every parameter has a default, which is what lets a four-column row call# this at all, and `upsample` is last so a positional API client that predates it is unaffected.prompt,image_1=None,audio_path=None,213 unmodified lineslora_inputs = [field for pair in zip(lora_references, lora_scales) for field in pair]lora_upload.upload(_fill_lora_slots, [lora_upload, *lora_references], lora_references, api_name=False)# Same order as `generate`'s signature: the exampled five first, then the remaining image slots, then the LoRA# fields the `*lora_fields` tail collects.request = [prompt, images[0], audio, video, canvas, *images[1:], match, duration, steps, seed, upsample, *lora_inputs]gr.Examples(examples=[["The character walks through a neon-lit street in the rain, humming to themselves","examples/subject.png",None,None,EXAMPLE_CANVAS,],["The character speaks to camera in a quiet room, lips matching every word","examples/subject.png","examples/voice.wav",None,EXAMPLE_PORTRAIT_CANVAS,],["The character moves with the same camera push, down a rainy alley at night","examples/subject.png",None,"examples/motion.mp4",EXAMPLE_CANVAS,],],inputs=[prompt, images[0], audio, video, canvas],outputs=[result, upsampled, upsampled_panel],fn=generate,cache_examples=True,cache_mode="lazy",)run.click(generate, request, [result, upsampled, upsampled_panel], api_name="generate")57 unmodified lines585960616263468 unmodified lines532533534535536537538539213 unmodified lines75375475575675775875976076176276376457 unmodified lines"1536x672 路 21:9 full": (672, 1536),}DEFAULT_CANVAS = "960x544 路 16:9 fast"FPS, FRAMES_PER_CHUNK, LATENTS_PER_CHUNK = 24, 17, 5# It is the *snapped* frame count the ceiling has to hold for: 15 s is 360 frames, which rounds up to 362, i.e.# 15.083 s, and is refused. 14 is the last whole second that survives the snap.468 unmodified linesdef generate(# Every parameter after `prompt` has a default, and the newest ones sit at the end, so a positional API client# written against an older signature keeps working.prompt,image_1=None,audio_path=None,213 unmodified lineslora_inputs = [field for pair in zip(lora_references, lora_scales) for field in pair]lora_upload.upload(_fill_lora_slots, [lora_upload, *lora_references], lora_references, api_name=False)# Same order as `generate`'s signature: the five leading columns first, then the remaining image slots, then the# LoRA fields the `*lora_fields` tail collects.request = [prompt, images[0], audio, video, canvas, *images[1:], match, duration, steps, seed, upsample, *lora_inputs]run.click(generate, request, [result, upsampled, upsampled_panel], api_name="generate")
app.py+4-37