Will-uob commited on
Commit
2b83f19
·
1 Parent(s): 2c9ca5c
Files changed (2) hide show
  1. app.py +25 -1
  2. requirements.txt +5 -0
app.py CHANGED
@@ -1,7 +1,31 @@
1
  import gradio as gr
 
 
 
 
 
 
2
 
3
  def greet(name):
4
  return "Hello " + name + "!!"
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  iface.launch()
 
1
  import gradio as gr
2
+ from torch import autocast
3
+ from diffusers import StableDiffusionPipeline
4
+
5
+ import re
6
+ import os
7
+ import requests
8
 
9
  def greet(name):
10
  return "Hello " + name + "!!"
11
 
12
+ def create_waifu(prompt):
13
+ pipe = StableDiffusionPipeline.from_pretrained(
14
+ 'hakurei/waifu-diffusion',
15
+ torch_dtype=torch.float32
16
+ ).to('cuda')
17
+
18
+ with autocast("cuda"):
19
+ image = pipe(prompt, guidance_scale=6)[0][0]
20
+
21
+ return image
22
+ """
23
+ Interface class is initialized with three required parameters
24
+ - fn: the function to wrap a UI around
25
+ - inputs: components to use for the input
26
+ - outputs: which components to use for the output
27
+ """
28
+ iface = gr.Interface(fn=greet,
29
+ inputs=gr.Textbox(lines=1, placeholder="Please enter your prompt..."),
30
+ outputs="image")
31
  iface.launch()
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ diffusers
2
+ transformers
3
+ torch
4
+ numpy
5
+ scipy