Vaibhavnaik12 commited on
Commit
4bf3dfb
·
verified ·
0 Parent(s):

initial commit

Browse files
Files changed (4) hide show
  1. .gitattributes +35 -0
  2. README.md +12 -0
  3. app.py +45 -0
  4. requirements.txt +2 -0
.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Koolerspace
3
+ emoji: 📚
4
+ colorFrom: pink
5
+ colorTo: purple
6
+ sdk: gradio
7
+ sdk_version: 5.9.1
8
+ app_file: app.py
9
+ pinned: false
10
+ ---
11
+
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This Gradio app uses the KolorsPipeline from the diffusers library to generate images based on a given prompt.
2
+ import gradio as gr
3
+ import torch
4
+ from diffusers import KolorsPipeline
5
+
6
+ # Load the KolorsPipeline model
7
+ pipe = KolorsPipeline.from_pretrained(
8
+ "Kwai-Kolors/Kolors-diffusers",
9
+ torch_dtype=torch.float16,
10
+ variant="fp16"
11
+ ).to("cuda")
12
+
13
+ # Define the function to generate an image based on the prompt
14
+ def generate_image(prompt, negative_prompt, guidance_scale, num_inference_steps, seed):
15
+ generator = torch.Generator(pipe.device).manual_seed(seed)
16
+ image = pipe(
17
+ prompt=prompt,
18
+ negative_prompt=negative_prompt,
19
+ guidance_scale=guidance_scale,
20
+ num_inference_steps=num_inference_steps,
21
+ generator=generator,
22
+ ).images[0]
23
+ return image
24
+
25
+ # Create the Gradio interface
26
+ with gr.Blocks() as demo:
27
+ with gr.Row():
28
+ prompt_input = gr.Textbox(label="Prompt", value="一张瓢虫的照片,微距,变焦,高质量,电影,拿着一个牌子,写着'可图'")
29
+ negative_prompt_input = gr.Textbox(label="Negative Prompt", value="")
30
+ with gr.Row():
31
+ guidance_scale_slider = gr.Slider(label="Guidance Scale", minimum=0.0, maximum=10.0, value=5.0, step=0.1)
32
+ num_inference_steps_slider = gr.Slider(label="Number of Inference Steps", minimum=1, maximum=100, value=50, step=1)
33
+ seed_slider = gr.Slider(label="Seed", minimum=0, maximum=100000, value=66, step=1)
34
+ generate_button = gr.Button("Generate Image")
35
+ output_image = gr.Image(label="Generated Image")
36
+
37
+ # Define the event listener for the generate button
38
+ generate_button.click(
39
+ fn=generate_image,
40
+ inputs=[prompt_input, negative_prompt_input, guidance_scale_slider, num_inference_steps_slider, seed_slider],
41
+ outputs=output_image
42
+ )
43
+
44
+ # Launch the Gradio app
45
+ demo.launch(show_error=True)
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ torch
2
+ diffusers