Diffusion50 / app.py
DiffusionArtco's picture
Update app.py
ad08da6
raw
history blame
4.77 kB
import gradio as gr
import requests
from PIL import Image
from io import BytesIO
import base64
api_url = "https://5cb20b40-572c-426f-9466-995256f9b6eb.id.repl.co/generate_image"
def generate_image(model="Deliberate", prompt="", seed=0, negative_prompt="", sampler="k_dpmpp_2s_a", steps=50):
data = "?model=" + model + "&prompt=" + prompt + "&seed=" + str(seed) + "&negative_prompt=" + negative_prompt + "&sampler=" + sampler + "&steps=" + str(steps)
response = requests.post(api_url + data, timeout=400)
if response.status_code == 200:
img_base64 = response.json()["url"]
img_bytes = base64.b64decode(img_base64)
img = Image.open(BytesIO(img_bytes))
return img
else:
return None
inputs = [
gr.inputs.Dropdown(['Analog Diffusion', 'Anything Diffusion', 'Anything v3', 'ChilloutMix', 'Counterfeit', 'CyriousMix', 'Deliberate', 'Dreamshaper', 'Dreamlike Diffusion', 'Dreamlike Photoreal', 'Experience', 'FaeTastic', 'Hassanblend', 'Mega Merge Diffusion', 'Midjourney Diffusion', 'ModernArt Diffusion', 'Movie Diffusion', 'NeverEnding Dream', 'Perfect World', 'PortraitPlus', 'ProtoGen', 'Protogen Anime', 'Protogen Infinity', 'RealBiter', 'Realism Engine', 'Realistic Vision', 'Rev Animated', 'RPG', 'Seek.art MEGA', 'stable_diffusion', 'stable_diffusion_2.1' , 'Unstable Ink Dream'], label="Model", default="Deliberate"),
gr.inputs.Textbox(label="Prompt", default=", Trending on artstation, Trending on MidJourney, Award Winning, Timeless art work, Masterpiece, Genius, Worldclass, Extra ordinary, Aesthetic, Beautiful, Stunning, Brilliant, cinematic, Dynamic, Cinematic lighting, inspirational, 4K resolution, 8K resolution, Artstation HD, Artstation HQ, Vivid, Vibrant, Ultra detailed, Octane render, dramatic, Iconic, Impeccable, Majestic, Ingenious, Visionary, Revolutionary, Exceptional, Exemplary, Unsurpassed, Viral, Popular, Buzzworthy, Up-and-coming, Emerging, Promising, Acclaimed, Celebrated, Distinguished, Classic, Enduring, Everlasting, Extraordinary, Phenomenal, Remarkable, Aesthetic, Stylish, Artistic, Sophisticated, Beautiful, Gorgeous, Exquisite, Breathtaking, Striking, Splendid, Dazzling, Radiant, Epic, Theatrical, Energetic, Thrilling, Exciting, Atmospheric, Evocative, Enchanting, Motivating, Empowering, Uplifting, High-definition, Crisp, Sharp, Ultra high-definition, Crystal clear, Flawless, High-quality, Premium, Deluxe, High-resolution, Top-notch, Elite, Bright, Lively, Colorful, Intricate, Meticulous, Elaborate, Realistic, High-performance, Intense, Gripping, Compelling (((Perfect face))), (((Perfect symmetrical Body anatomy))), (((Perfect Fingers)))."),
gr.inputs.Number(label="Seed", default=0),
gr.inputs.Textbox(label="Negative Prompt", default="Deformed arm, missing arm, low resolution, low quality, twisted, unappealing, uneven, unprofessional, draft, fake face, fake, uneven body, unnatural face, plastic face, out of focus, out of frame, poorly drawn, crippled, crooked, broken, weird, distorted, erased, cut, mutilated, sloppy, ugly, pixelated, bad hands, aliasing, overexposed, oversaturated, burnt image, fuzzy, poor quality, sleepy, closed-eyes, bad anatomy, hideous, deformed, mutant, poorly detailed, smudged, sketch, pencil, doll, plastic, disfigured, close-up, topless, nude, naked, cleavage, breasts, belly, disproportionate bodies, two heads, deformed fingers, elongated body, two faces, cropped image, deformed hands, deformed legs, deformed face, twisted fingers, double image, long neck, extra limb, poorly drawn hands, missing limb, grainy, blurry, poorly drawn face, mutation, disconnected limbs, long body, disgusting, mangled, extra fingers, gross proportions, missing arms, mutated hands, mutilated hands, cloned face, missing legs, cut-off, kitsch, text, logo, wordmark, writing, heading, signature, watermark, toy, sculpture, tiling, crossed eyes, extra limbs, body out of frame, blurred, cut off, duplicate, distortion of proportions, anatomy, copy, multi, grain, low-res, mutated, floating limbs, malformed hands, blur, old, heterochromia, dots, bad quality, weapons, scary, creepy, evil, missing limbs, gross, missing fingers."),
gr.inputs.Dropdown(["k_lms", "k_heun", "k_euler", "k_euler_a", "k_dpm_2", "k_dpm_2_a", "DDIM", "k_dpm_fast", "k_dpm_adaptive", "k_dpmpp_2m", "k_dpmpp_2s_a", "k_dpmpp_sde"], label="Sampler", default="k_dpmpp_2s_a"),
gr.inputs.Number(label="Steps", default=50)
]
outputs = gr.outputs.Image(label="Generated Image", type="pil")
interface = gr.Interface(generate_image, inputs, outputs, title="Most Popular",
description="Live access some of the most popular Art, Anime, Fantasy & Realistic Art models",
examples=[])
interface.launch()