ghosthamlet multimodalart HF staff commited on
Commit
537e2b2
0 Parent(s):

Duplicate from kakaobrain/karlo

Browse files

Co-authored-by: Multimodal AI art <multimodalart@users.noreply.huggingface.co>

Files changed (4) hide show
  1. .gitattributes +34 -0
  2. README.md +13 -0
  3. app.py +67 -0
  4. requirements.txt +4 -0
.gitattributes ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ *.tflite filter=lfs diff=lfs merge=lfs -text
29
+ *.tgz filter=lfs diff=lfs merge=lfs -text
30
+ *.wasm filter=lfs diff=lfs merge=lfs -text
31
+ *.xz filter=lfs diff=lfs merge=lfs -text
32
+ *.zip filter=lfs diff=lfs merge=lfs -text
33
+ *.zst filter=lfs diff=lfs merge=lfs -text
34
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Karlo
3
+ emoji: 🖌️🎨
4
+ colorFrom: blue
5
+ colorTo: indigo
6
+ sdk: gradio
7
+ sdk_version: 3.14.0
8
+ app_file: app.py
9
+ pinned: false
10
+ duplicated_from: kakaobrain/karlo
11
+ ---
12
+
13
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import torch
3
+ from diffusers import UnCLIPPipeline
4
+
5
+ pipe = UnCLIPPipeline.from_pretrained("kakaobrain/karlo-v1-alpha", torch_dtype=torch.float16)
6
+ pipe = pipe.to("cuda")
7
+
8
+ def run(prompt):
9
+ images = pipe(prompt, num_images_per_prompt=6).images
10
+ return images
11
+
12
+ css = '''
13
+ .container{max-width: 800px}
14
+ #title_area{text-align: center}
15
+ #title_area h2{margin-bottom: 0.25em}
16
+ .footer {margin-bottom: 45px;text-align: center;border-bottom: 1px solid #e5e5e5}
17
+ .footer>p {font-size: .8rem;display: inline-block;padding: 0 10px;transform: translateY(10px);background: white}
18
+ .dark .footer {border-color: #303030}
19
+ .dark .footer>p {background: #0b0f19}
20
+ .acknowledgments h4{margin: 1.25em 0 .25em 0;font-weight: bold;font-size: 115%}
21
+ '''
22
+
23
+ with gr.Blocks(css=css) as demo:
24
+ with gr.Column(variant="panel"):
25
+ gr.Markdown('''## Karlo - unCLIP model by KakaoBrain
26
+ ##### [Open source large scale replication](https://github.com/kakaobrain/karlo) of unCLIP, the DALL-E 2 technique. For more try our [B^DISCOVER app](https://bdiscover.kakaobrain.com/)
27
+ ''', elem_id="title_area")
28
+ with gr.Row(variant="compact"):
29
+ text = gr.Textbox(
30
+ label="Enter your prompt",
31
+ show_label=False,
32
+ max_lines=1,
33
+ placeholder="Enter your prompt",
34
+ ).style(
35
+ container=False,
36
+ )
37
+ btn = gr.Button("Generate image").style(full_width=False)
38
+
39
+ gallery = gr.Gallery(
40
+ label="Generated images", show_label=False, elem_id="gallery"
41
+ ).style(grid=[3], height="auto")
42
+ text.submit(run, text, gallery)
43
+ btn.click(run, text, gallery)
44
+ examples = ["A man with a face of avocado, in the drawing style of Rene Magritte", "a black porcelain in the shape of pikachu", "a portrait of an old monk, highly detailed", "A teddy bear on a skateboard, children drawing style.", ]
45
+ ex = gr.Examples(examples=examples, fn=run, inputs=text, outputs=gallery, cache_examples=True)
46
+ ex.dataset.headers = [""]
47
+ gr.HTML('''
48
+ <p style="text-align: center;font-size: 94%">
49
+ For Faster Results you can skip the queue by duplicating this space:&nbsp;&nbsp;
50
+ <a style="display: inline-block" href="https://huggingface.co/kakaobrain/karlo?duplicate=true"><img src="https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14" alt="Duplicate Space"></a>
51
+ </p>
52
+ ''')
53
+ gr.HTML(
54
+ """
55
+ <div class="footer">
56
+ <p>Model by <a href="https://huggingface.co/kakaobrain" style="text-decoration: underline;" target="_blank">KakaoBrain</a> - Gradio Demo running on 🧨 diffusers by 🤗 Hugging Face
57
+ </p>
58
+ </div>
59
+ <div class="acknowledgments">
60
+ <p><h4>LICENSE</h4>
61
+ The model is licensed with a <a href="https://github.com/kakaobrain/karlo/blob/main/LICENSE" style="text-decoration: underline;" target="_blank">CreativeML OpenRAIL</a> license. The authors claim no rights on the outputs you generate, you are free to use them and are accountable for their use which must not go against the provisions set in this license. The license forbids you from sharing any content that violates any laws, produce any harm to a person, disseminate any personal information that would be meant for harm, spread misinformation and target vulnerable groups. For the full list of restrictions please <a href="https://huggingface.co/spaces/CompVis/stable-diffusion-license" target="_blank" style="text-decoration: underline;" target="_blank">read the license</a></p>
62
+ <p><h4>Biases and content acknowledgment</h4>
63
+ Despite how impressive being able to turn text into image is, beware to the fact that this model may output content that reinforces or exacerbates societal biases, as well as realistic faces, pornography and violence. The model was trained on a filtered subset of the <a href="https://github.com/kakaobrain/coyo-dataset" style="text-decoration: underline;" target="_blank">COYO-700M dataset</a>, which scraped image-text-pairs from the internet for research purposes. You can read more in the <a href="https://huggingface.co/kakaobrain/karlo-v1-alpha" style="text-decoration: underline;" target="_blank">model card</a></p>
64
+ </div>
65
+ """
66
+ )
67
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ diffusers==0.11.1
2
+ transformers==4.25.1
3
+ safetensors==0.2.6
4
+ accelerate==0.15.0