import gradio as gr from huggingface_hub import InferenceClient # Connecting to the ultra-fast FLUX image cluster client = InferenceClient() def generate_studio_art(prompt): if not prompt: return None print(f"RustyAI Engine is rendering art for: {prompt}") try: # Call the server to instantly bake a high-fidelity image file image = client.text_to_image( prompt=prompt, model="black-forest-labs/FLUX.1-schnell" ) # Save the crisp image file to display output_filename = "rusty_studio_art.png" image.save(output_filename) return output_filename except Exception as e: print(f"Studio Error: {e}") return None # Custom UI layout for your RustyAI Image Studio with 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()