File size: 1,610 Bytes
34fbcbd
 
 
 
 
09b528e
34fbcbd
 
340a978
34fbcbd
 
48f34fb
b033c86
48f34fb
b033c86
34fbcbd
 
31cce0c
86381bc
 
5283a58
48f34fb
e712316
09b528e
34fbcbd
5175b6c
48f34fb
34fbcbd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import gradio as gr
import torch
import numpy as np
import modin.pandas as pd
from PIL import Image
from diffusers import DiffusionPipeline

device = "cuda" if torch.cuda.is_available() else "cpu"
pipe = DiffusionPipeline.from_pretrained("circulus/canvers-anime-v3.8.1", safety_checker=None)
pipe = pipe.to(device)

def genie (Prompt, negative_prompt, scale, seed):
    generator = torch.Generator(device=device).manual_seed(seed)
    image = pipe(Prompt, negative_prompt=negative_prompt, height=512, width=512, guidance_scale=scale, generator=generator).images[0]
    return image
    
gr.Interface(fn=genie, inputs=[gr.Textbox(label='What you want the AI to generate. 77 Token Limit.'), 
                               gr.Textbox(label='What you Do Not want the AI to generate. 77 Token Limit'),
                               #gr.Slider(512, 768, 512, step=128, label='height'),
                               #gr.Slider(512, 768, 512, step=128, label='width'),
                               gr.Slider(1, maximum=9, value=5, step=.25), 
                               #gr.Slider(1, maximum=50, value=25, step=1), 
                               gr.Slider(minimum=0, step=1, maximum=9999999999999999, randomize=True, label='Seed'),
                              ],
             outputs = 'image',
             title = 'Canvers Anime V3.8.1 - CPU', 
             description = "<b>WARNING:</b> Extremely Slow. 15s/Iteration. Expect 8-16mins. 50 iterations takes ~15mins.", 
             article = "Code Monkey: <a href=\"https://huggingface.co/Manjushri\">Manjushri</a>").launch(debug=True, max_threads=True)