rajsecrets0 commited on
Commit
96e79de
·
1 Parent(s): 37ffe45

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -0
app.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from diffusers import StableDiffusionXLPipeline
2
+ import torch
3
+ from transformers.pipelines.image_to_text import Image
4
+ from IPython.display import display
5
+ import gradio as gr
6
+
7
+
8
+ from diffusers.utils.import_utils import USE_SAFETENSORS
9
+ pipe = StableDiffusionXLPipeline.from_pretrained(
10
+ "segmind/SSD-1B",
11
+ tensor_dtype = torch.float16,
12
+ USE_SAFETENSORS = True,
13
+ variant = 'fp16'
14
+ )
15
+
16
+ pipe.to('cuda')
17
+
18
+ prompt = 'most beutiful woMEN young realistic high quality '
19
+ neg_prompt = 'ugly, blurry, poor quality'
20
+
21
+ image = pipe(prompt = prompt , negative_prompt = neg_prompt).images[0]
22
+
23
+ display(image)
24
+
25
+
26
+ def greet(prompt):
27
+ return "Hello " + prompt + "!!"
28
+
29
+ iface = gr.Interface(fn=greet, inputs="text", outputs="image")
30
+ iface.launch()