Spaces:
Sleeping
Sleeping
import gradio as gr | |
# Load the model | |
model = gr.load("models/strangerzonehf/Flux-Midjourney-Mix2-LoRA") | |
# Define the custom HTML and CSS | |
custom_html = """ | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>D&D Themed Gradio Space</title> | |
<style> | |
body { | |
background-color: #231f20; | |
color: #f5f5f5; | |
font-family: 'Arial', sans-serif; | |
} | |
.gradio-container { | |
max-width: 800px; | |
margin: 0 auto; | |
padding: 20px; | |
background-color: #3c2f2f; | |
border: 2px solid #8b4513; | |
border-radius: 10px; | |
box-shadow: 0 0 20px rgba(0, 0, 0, 0.5); | |
} | |
h1, h2, h3, h4, h5, h6 { | |
color: #ffd700; | |
text-align: center; | |
} | |
button { | |
background-color: #8b4513; | |
color: #f5f5f5; | |
border: none; | |
padding: 10px 20px; | |
border-radius: 5px; | |
cursor: pointer; | |
transition: background-color 0.3s; | |
} | |
button:hover { | |
background-color: #a0522d; | |
} | |
input[type="text"], input[type="file"], textarea { | |
background-color: #3c2f2f; | |
color: #f5f5f5; | |
border: 1px solid #8b4513; | |
border-radius: 5px; | |
padding: 10px; | |
width: 100%; | |
box-sizing: border-box; | |
margin-bottom: 10px; | |
} | |
input[type="text"]:focus, input[type="file"]:focus, textarea:focus { | |
border-color: #ffd700; | |
} | |
label { | |
color: #ffd700; | |
} | |
.gradio-output { | |
background-color: #3c2f2f; | |
border: 1px solid #8b4513; | |
border-radius: 5px; | |
padding: 20px; | |
margin-top: 20px; | |
text-align: center; | |
} | |
.gradio-output img { | |
max-width: 100%; | |
border-radius: 10px; | |
} | |
.footer { | |
text-align: center; | |
margin-top: 20px; | |
color: #ffd700; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="gradio-container"> | |
<h1>D&D Themed Gradio Space</h1> | |
<div id="gradio-app"></div> | |
<div class="footer"> | |
<p>Powered by Hugging Face and Gradio</p> | |
</div> | |
</div> | |
</body> | |
</html> | |
""" | |
# Define the Gradio interface | |
iface = gr.Interface( | |
fn=model, | |
inputs=gr.Textbox(lines=2, placeholder="Enter your prompt here..."), | |
outputs=gr.Image(type="pil"), | |
title="D&D Themed Gradio Space", | |
description="Generate images using the Flux-Midjourney-Mix2-LoRA model.", | |
css=custom_html | |
) | |
# Launch the Gradio interface | |
iface.launch() |