|
import gradio as gr |
|
import random |
|
|
|
model = gr.load("models/Purz/face-projection") |
|
|
|
def generate_image(text, seed): |
|
if seed is not None: |
|
random.seed(seed) |
|
|
|
if text in [example[0] for example in examples]: |
|
print(f"Using example: {text}") |
|
|
|
return model(text) |
|
|
|
examples = [ |
|
["Bioluminescent forest with glowing plants and animals, mystical night scene", None], |
|
["Cyberpunk cityscape with neon lights and rainy streets, high detail", None], |
|
["Ancient stone guardian statues in a dense jungle, sunlight breaking through trees", None], |
|
["Futuristic underwater city with transparent domes and exotic marine life", None], |
|
["Enchanted waterfall with floating islands and magical creatures, fantasy setting", None], |
|
["Steampunk airship flying over a bustling Victorian city, clockwork details", None], |
|
["Gigantic desert robot partially buried in sand, mysterious and weathered", None], |
|
["Space station orbiting a colorful nebula, cosmic view", None], |
|
["Medieval blacksmith forging a magical sword, glowing with energy", None], |
|
["Nordic warrior facing a giant sea serpent in stormy waters, epic scene", None] |
|
] |
|
|
|
|
|
interface = gr.Interface( |
|
fn=generate_image, |
|
inputs=[ |
|
gr.Textbox(label="Type here your imagination:", placeholder="Type or click an example..."), |
|
gr.Slider(minimum=0, maximum=10000, step=1, label="Seed (optional)") |
|
], |
|
outputs=gr.Image(label="Generated Image"), |
|
examples=examples, |
|
theme="NoCrypt/miku", |
|
) |
|
|
|
interface.launch() |