ciditel commited on
Commit
c259297
·
1 Parent(s): 18fa0fe

init commit

Browse files
Files changed (1) hide show
  1. app.py +28 -4
app.py CHANGED
@@ -1,7 +1,31 @@
 
 
 
 
1
  import gradio as gr
 
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from PIL import Image
2
+ from transformers import DonutProcessor, VisionEncoderDecoderModel
3
+ import torch
4
+ import re
5
  import gradio as gr
6
+ from diffusers import AutoPipelineForText2Image
7
+ import torch
8
 
9
+ pipeline_text2image = AutoPipelineForText2Image.from_pretrained("stabilityai/sdxl-turbo", torch_dtype=torch.float16, variant="fp16")
10
+ pipeline_text2image = pipeline_text2image.to("cuda")
11
 
12
+
13
+ def text2img(prompt = "A cinematic shot of a baby racoon wearing an intricate italian priest robe.",guidance_scale=0.0, num_inference_steps=1):
14
+ image = pipeline_text2image(prompt=prompt, guidance_scale=guidance_scale, num_inference_steps=num_inference_steps).images[0]
15
+ return image
16
+
17
+ gradio_app_text2img = gr.Interface(
18
+ fn=text2img,
19
+ inputs=[
20
+ gr.Text(),
21
+ gr.Slider(0.0, 10.0, value=1,step=0.1),
22
+ gr.Slider(0.0, 10.0, value=1,step=1)
23
+ ],
24
+ outputs="image",
25
+ )
26
+
27
+
28
+ demo = gr.TabbedInterface([gradio_app_text2img], ["text2img"])
29
+
30
+ if __name__ == "__main__":
31
+ demo.launch()