File size: 792 Bytes
2c9ca5c
5471374
2b83f19
 
 
 
 
 
2c9ca5c
 
 
 
2b83f19
 
 
1d21147
729ee01
2b83f19
729ee01
2b83f19
 
 
 
 
 
 
 
39a5d5f
2b83f19
 
2c9ca5c
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
29
30
31
import gradio as gr
import torch
from torch import autocast
from diffusers import StableDiffusionPipeline

import re
import os
import requests

def greet(name):
    return "Hello " + name + "!!"

def create_waifu(prompt):
    pipe = StableDiffusionPipeline.from_pretrained(
    'hakurei/waifu-diffusion',
    torch_dtype=torch.float16
    )

    image = pipe(prompt, guidance_scale=6)[0][0]

    return image
"""
Interface class is initialized with three required parameters
- fn: the function to wrap a UI around
- inputs: components to use for the input
- outputs: which components to use for the output
"""
iface = gr.Interface(fn=create_waifu, 
                    inputs=gr.Textbox(lines=1, placeholder="Please enter your prompt..."), 
                    outputs="image")
iface.launch()