Spaces:
Build error
Build error
Paweł Klimkowski
commited on
Commit
·
75d7e79
1
Parent(s):
1691503
feat: let's see
Browse files- app.py +29 -0
- requirements.txt +2 -0
app.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from torch import autocast
|
3 |
+
from diffusers import StableDiffusionPipeline
|
4 |
+
import torch
|
5 |
+
|
6 |
+
model_id = "models/pawelklimkowski/tylko-sd-dream" #@param {type:"string"}
|
7 |
+
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to("cuda")
|
8 |
+
|
9 |
+
def inference(prompt, num_samples):
|
10 |
+
all_images = []
|
11 |
+
images = pipe(prompt, num_images_per_prompt=num_samples, num_inference_steps=50, guidance_scale=7.5).images
|
12 |
+
all_images.extend(images)
|
13 |
+
return all_images
|
14 |
+
|
15 |
+
with gr.Blocks() as demo:
|
16 |
+
gr.HTML("<h2 style=\"font-size: 2em; font-weight: bold\" align=\"center\">Run Concept</h2>")
|
17 |
+
with gr.Row():
|
18 |
+
with gr.Column():
|
19 |
+
prompt = gr.Textbox(label="prompt")
|
20 |
+
samples = gr.Slider(label="Samples",value=1)
|
21 |
+
run = gr.Button(value="Run")
|
22 |
+
with gr.Column():
|
23 |
+
gallery = gr.Gallery(show_label=False)
|
24 |
+
|
25 |
+
run.click(inference, inputs=[prompt,samples], outputs=gallery)
|
26 |
+
gr.Examples([["a photo of oklyt", 1,1]], [prompt,samples], gallery, inference, cache_examples=False)
|
27 |
+
|
28 |
+
|
29 |
+
demo.launch(debug=True)
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
transformers
|
2 |
+
torch
|