wifix199 commited on
Commit
81ac59f
1 Parent(s): fd31bc7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -1
app.py CHANGED
@@ -1,3 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
 
 
 
 
2
 
3
- gr.load("models/SG161222/SG161222/RealVisXL_V4.0_Lightning",alias="our").launch()
 
1
+ from diffusers import StableDiffusionPipeline
2
+ import torch
3
+
4
+ modelieo=[
5
+ 'naclbit/trinart_stable_diffusion_v2',
6
+ ]
7
+
8
+
9
+ def TextToImage(Prompt,model):
10
+ model_id = model
11
+ pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
12
+ pipe = pipe.to("cpu")
13
+
14
+ prompt = Prompt
15
+ image = pipe(prompt).images[0]
16
+
17
+ return image
18
+
19
+
20
  import gradio as gr
21
+ interface = gr.Interface(fn=TextToImage,
22
+ inputs=["text", gr.Dropdown(modelieo)],
23
+ outputs="image",
24
+ title='Text to Image')
25
 
26
+ interface.launch()