import gradio as gr import random # Load the model model = gr.load("models/Purz/face-projection") # Function to generate image def generate_image(text, seed): if seed is not None: random.seed(seed) return model(text) # Define example inputs examples = [ ["Humanoid Cat Warrior, Full View", None], ["Warhammer Sisterhood", None], ["Future Robots war", None], ["Fantasy dragon", None] ] # Customized Gradio Interface interface = gr.Interface( fn=generate_image, inputs=[ gr.Textbox(label="Imagine and Type Here:", placeholder="Type your idea or click an example...", elem_id="input-text"), gr.Slider(minimum=0, maximum=10000, step=1, label="Seed (optional)", elem_id="seed-slider") ], outputs=gr.Image(label="Generated Image", elem_id="output-image"), examples=examples, theme="default", description="The model is currently running on CPU. Performance might vary. Thanks for your patience.", css=""" #input-text, #seed-slider .input-label, .output-label, .description { font-family: 'Arial', sans-serif; text-align: center; color: #333; } .container { background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%); border-radius: 12px; padding: 10px; } .btn { background: linear-gradient(90deg, #ff8a00, #e52e71); border: none; border-radius: 25px; color: white; padding: 12px 24px; font-size: 16px; font-weight: bold; cursor: pointer; } .examples-table { text-align: center; } """ ) # Launch the interface interface.launch()