Spaces:
Sleeping
Sleeping
Update app.py
Browse files12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849import gradio as grfrom huggingface_hub import InferenceClient# Initialize the inference client for direct text-to-video generationclient = InferenceClient()def generate_video_from_text(prompt):if not prompt:return Noneprint(f"RustyAI Engine is manufacturing video for: {prompt}")try:# Call the external GPU cluster to build a video from text wordsvideo_bytes = client.text_to_video(prompt,model="Lightricks/LTX-Video")output_path = "rusty_text_motion.mp4"with open(output_path, "wb") as f:f.write(video_bytes)print("RustyAI Engine: Text-to-Video generation complete!")return output_pathexcept Exception as e:print(f"Text-to-Video Error: {e}")return None# Clean, simple UI layout for prompt typingwith gr.Blocks(title="RustyAI Text-to-Video") as demo:gr.Markdown("# 🎬 RustyAI Text-to-Video Generator")gr.Markdown("Type a scene description below and watch the AI manifest it into a video clip.")with gr.Row():with gr.Column():user_prompt = gr.Textbox(label="Describe your video scene",placeholder="e.g., A multi-armed wooden creature swinging baseball bats in a dark room, analog horror style...")run_btn = gr.Button("Bake Video 🚀", variant="primary")with gr.Column():video_output = gr.Video(label="Generated MP4 Output")run_btn.click(fn=generate_video_from_text, inputs=user_prompt, outputs=video_output)if __name__ == "__main__":demo.launch()1234567891011121314151617181920212223242526272829303132333435363738394041424344454647import gradio as grfrom huggingface_hub import InferenceClient# Connecting to the ultra-fast FLUX image clusterclient = InferenceClient()def generate_studio_art(prompt):if not prompt:return Noneprint(f"RustyAI Engine is rendering art for: {prompt}")try:# Call the server to instantly bake a high-fidelity image fileimage = client.text_to_image(prompt=prompt,model="black-forest-labs/FLUX.1-schnell")# Save the crisp image file to displayoutput_filename = "rusty_studio_art.png"image.save(output_filename)return output_filenameexcept Exception as e:print(f"Studio Error: {e}")return None# Custom UI layout for your RustyAI Image Studiowith gr.Blocks(title="RustyAI Image Studio") as demo:gr.Markdown("# 🎨 RustyAI Image Studio")gr.Markdown("Type an idea, hit generate, and watch the FLUX engine bake high-speed concept art!")with gr.Row():with gr.Column():user_prompt = gr.Textbox(label="Describe your artwork or character design",placeholder="e.g., A terrifying analog horror entity with glowing eyes standing in a dark basement, VHS tape overlay, highly detailed 3D render...")run_btn = gr.Button("Generate Art ✨", variant="primary")with gr.Column():image_output = gr.Image(label="Rendered Result")run_btn.click(fn=generate_studio_art, inputs=user_prompt, outputs=image_output)if __name__ == "__main__":demo.launch()
app.py+21-23