MaxMilan1 commited on
Commit
2cf6be0
·
1 Parent(s): d6a4610
Files changed (3) hide show
  1. app.py +33 -0
  2. ckpts/snckrsgen.safetensors +3 -0
  3. requirements.txt +13 -0
app.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import numpy as np
3
+ from PIL import Image
4
+ import torch
5
+ import safetensors.torch as st
6
+ from diffusers import DiffusionPipeline
7
+
8
+ model_id = "./ckpts/snckrsgen.safetensors"
9
+ pipe = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16, use_safe_tensors=True)
10
+ pipe.to("cuda")
11
+
12
+ # Function to generate an image from text using diffusion
13
+ def generate_image(prompt):
14
+
15
+ images = pipe(prompt=prompt)
16
+ return images[0]
17
+
18
+ # Gradio interface
19
+ inputs = gr.inputs.Textbox(lines=5, label="Enter text to generate image:")
20
+ outputs = gr.outputs.Image(label="Generated Image")
21
+
22
+ title = "ShoeGen: Generate an Image of a Shoe"
23
+ description = "Enter a text description of a shoe to generate an image of the shoe."
24
+ examples = [["A red shoe with white laces and black sole."], ["A blue sneaker with a white stripe."], ["A brown boot with a buckle."]]
25
+
26
+ gr.Interface(
27
+ fn=generate_image,
28
+ inputs=inputs,
29
+ outputs=outputs,
30
+ title=title,
31
+ description=description,
32
+ examples=examples
33
+ ).launch()
ckpts/snckrsgen.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e80bf5f4ded84793d74c9939b0fc1a09b76af31bafe2ac3190c21c9be5eb6965
3
+ size 151112168
requirements.txt ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ torch
2
+ torchvision
3
+ diffusers
4
+ gradio
5
+ numpy
6
+ PIL
7
+ safetensors
8
+ scipy
9
+ ftfy
10
+ psutil
11
+ accelerate==0.12.0
12
+ transformers
13
+ https://github.com/camenduru/stable-diffusion-webui-colab/releases/download/0.0.15/xformers-0.0.15.dev0+4c06c79.d20221205-cp38-cp38-linux_x86_64.whl