Spaces:
Runtime error
Runtime error
Ubuntu
commited on
Commit
•
e83b3b3
1
Parent(s):
59ab309
Add application file
Browse files
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
def greet(name):
|
4 |
+
return "Hello " + name + "!!"
|
5 |
+
|
6 |
+
def produce_art(prompt):
|
7 |
+
from diffusers import StableDiffusionPipeline
|
8 |
+
import torch
|
9 |
+
|
10 |
+
model_id = "model_rita1/1600"
|
11 |
+
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to("cuda")
|
12 |
+
|
13 |
+
bs = 1
|
14 |
+
images = pipe([prompt]*bs, num_inference_steps=50, guidance_scale=7.5)
|
15 |
+
# [images.images[i].save(f"rita-stalin-kefir{i+j*bs}.png") for i in range(bs)]
|
16 |
+
return images.images[0]
|
17 |
+
|
18 |
+
prompt = "RitaT style collage of Stalin with Kefir in outer space, fine details trending on arthouse"
|
19 |
+
iface = gr.Interface(fn=produce_art, inputs="text", outputs="image")
|
20 |
+
iface.launch()
|