Spaces:
Sleeping
Sleeping
import gradio as gr | |
# Load the model | |
model = gr.load("models/strangerzonehf/Flux-Midjourney-Mix2-LoRA") | |
# Define D&D-specific CSS with rich theming | |
custom_css = """ | |
body { | |
background-color: #1b1b1b; /* A dark, dungeon-like background */ | |
color: #f0e6d2; /* Off-white text to mimic aged parchment */ | |
font-family: 'Palatino Linotype', serif; /* Adds a fantasy-inspired font style */ | |
margin: 0; | |
padding: 0; | |
display: flex; | |
flex-direction: column; | |
align-items: center; | |
justify-content: center; | |
height: 100vh; | |
} | |
.gradio-container { | |
max-width: 900px; | |
margin: auto; | |
padding: 25px; | |
background: linear-gradient(145deg, #2e2b2a, #3a3433); /* Subtle gradient for depth */ | |
border: 3px solid #a0522d; /* Bronze/gold-tone border resembling ancient artifacts */ | |
border-radius: 15px; | |
box-shadow: 0 0 15px rgba(0, 0, 0, 0.8); /* Shadowing for a mysterious effect */ | |
} | |
h1, h2 { | |
color: #ffd700; /* Gold to evoke a high-fantasy vibe */ | |
text-shadow: 2px 2px #7c5200; /* Slight shadow for richness */ | |
text-align: center; | |
} | |
textarea, input[type="text"] { | |
background-color: #2a2927; /* Dark stone-like input background */ | |
color: #f5e6ca; /* Light text for easy readability */ | |
border: 2px solid #8b4513; /* Earthy brown border */ | |
border-radius: 5px; | |
padding: 10px; | |
font-family: 'Palatino Linotype', serif; /* Matches fantasy feel */ | |
font-size: 16px; | |
} | |
textarea:focus, input[type="text"]:focus { | |
outline: none; | |
border-color: #ffd700; /* Highlight effect when focused */ | |
box-shadow: 0 0 5px #ffd700; | |
} | |
button { | |
background: #8b4513; /* Button styled in earthy tones */ | |
color: #f0e6d2; | |
font-family: 'Palatino Linotype', serif; | |
font-size: 18px; | |
border: none; | |
border-radius: 8px; | |
padding: 12px 25px; | |
cursor: pointer; | |
transition: 0.3s ease-in-out; | |
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); | |
} | |
button:hover { | |
background: #a0522d; /* Lighter tone for hover */ | |
box-shadow: 0 0 10px #ffd700; | |
} | |
.gradio-output { | |
background-color: #292828; /* Keeps output aligned with the theme */ | |
color: #ffd700; | |
border: 1px solid #8b4513; | |
border-radius: 8px; | |
margin-top: 20px; | |
padding: 15px; | |
text-align: center; | |
} | |
.gradio-output img { | |
max-width: 100%; | |
border: 2px solid #a0522d; | |
border-radius: 8px; | |
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); | |
} | |
.footer { | |
margin-top: 20px; | |
font-size: 14px; | |
text-align: center; | |
color: #ffd700; | |
text-shadow: 1px 1px #7c5200; | |
} | |
""" | |
# Define Gradio interface | |
iface = gr.Interface( | |
fn=model, # Model function | |
inputs=gr.Textbox(lines=3, label="Enter Your Quest Here:", placeholder="Describe the scene, character, or item..."), | |
outputs=gr.Image(type="pil", label="Your Epic Creation"), | |
title="🛡️ Dungeons & Dragons Image Generator ⚔️", | |
description="Step into the Forgotten Realms and summon visuals straight out of your imagination. Powered by Flux-Midjourney-Mix2-LoRA!", | |
css=custom_css | |
) | |
# Launch the interface | |
iface.launch() | |