Update a.py
Browse files11 unmodified lines12131415161718192021222324252627282930313233343573 unmodified lines10911011111211311411511611711811 unmodified linesapi_key=API_KEY,)def generate_video(image, prompt_text, progress=gr.Progress()):"""Generate video using HF temp URL trick"""if not API_KEY:yield "❌ API Key not configured. Please add 'Key' secret.", Nonereturnif image is None:yield "⚠️ Please upload an image first", Nonereturntry:progress(0, desc="Preparing image...")# THE TRICK: Get the Hugging Face temp URL# When type="filepath", image.name gives us the local path# HF automatically serves it as /file=pathimage_url = f"/file={image.name}"print(f"Using image URL: {image_url}")yield "✅ Image ready! Creating video request...", None73 unmodified lineswith gr.Row():with gr.Column():# Image upload - CHANGED to type="filepath" to get the temp URLimage_input = gr.Image(label="Upload Starting Image",type="filepath", # This gives us image.name with the temp pathheight=300)11 unmodified lines121314151617181920212223242526272829303132333473 unmodified lines10810911011111211311411511611711 unmodified linesapi_key=API_KEY,)def generate_video(image_path, prompt_text, progress=gr.Progress()):"""Generate video using HF temp URL trick"""if not API_KEY:yield "❌ API Key not configured. Please add 'Key' secret.", Nonereturnif image_path is None:yield "⚠️ Please upload an image first", Nonereturntry:progress(0, desc="Preparing image...")# THE TRICK: image_path is already the file path string# HF automatically serves it as /file=pathimage_url = f"/file={image_path}"print(f"Using image URL: {image_url}")yield "✅ Image ready! Creating video request...", None73 unmodified lineswith gr.Row():with gr.Column():# Image upload - type="filepath" returns a string pathimage_input = gr.Image(label="Upload Starting Image",type="filepath", # This returns a string pathheight=300)
a.py+6-7