import gradio as gr from PIL import Image import time # Load the model from Hugging Face model = gr.load("models/prashanth970/flux-lora-uncensored") # Define Gradio interface with a loading animation def model_with_loading(prompt): return model(prompt) # Custom CSS for D&D theme custom_css = """ @import url('https://fonts.googleapis.com/css2?family=MedievalSharp&display=swap'); body { background-color: #1a1a1a; color: #f5f5f5; font-family: 'MedievalSharp', cursive; } .gradio-container { background-color: #2c2c2c; border-radius: 15px; box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4); padding: 20px; } .gr-button { background-color: #8b4513; color: #f5f5f5; border: none; border-radius: 8px; padding: 12px 24px; font-size: 18px; cursor: pointer; transition: background-color 0.3s; } .gr-button:hover { background-color: #a0522d; } .gr-textbox { background-color: #3c3c3c; color: #f5f5f5; border: 2px solid #8b4513; border-radius: 8px; padding: 12px; font-size: 18px; width: 100%; box-sizing: border-box; } .gr-textbox::placeholder { color: #d3d3d3; } .gr-image { border: 4px solid #8b4513; border-radius: 15px; margin-top: 20px; } .gr-title { color: #ffd700; font-size: 32px; font-weight: bold; text-align: center; margin-bottom: 20px; } .gr-description { color: #ffd700; font-size: 20px; text-align: center; margin-bottom: 20px; } .gr-link { color: #ffd700; text-decoration: underline; font-size: 18px; } .gr-link:hover { color: #ffa500; } """ # Define Gradio interface iface = gr.Interface( fn=model_with_loading, inputs=gr.Textbox(lines=3, label="🎲 Enter Your Quest:", placeholder="Describe your scene, hero, or epic landscape..."), outputs=gr.Image(type="pil", label="🖼️ Your Legendary Vision"), title="🛡️ Dungeons & Dragons Image Generator ⚔️", description="**Unleash Your Imagination!** Create heroes, maps, quests, and epic scenes to bring your campaigns to life. " "Tailored for adventurers seeking inspiration or Dungeon Masters constructing their next grand story.
" "[Visit Our Website](https://chatdnd.net) | [Support Us](https://buymeacoffee.com/watchoutformike)", css=custom_css, live=False ) # Launch the interface iface.launch()