nielsgl commited on
Commit
ae44012
·
1 Parent(s): f1d405b

update app

Browse files
Files changed (1) hide show
  1. app.py +51 -18
app.py CHANGED
@@ -47,19 +47,19 @@ title = "KerasCV Stable Diffusion Demo on images of Ace."
47
  description = "This is a dreambooth model fine-tuned on images of my pug named Ace. To try it, input the concept with `puggieace dog`."
48
  examples=[
49
  ["A photo of puggieace dog in space", "", 10, 50],
50
- ["A photo of a cute puggieace dog getting a haircut in a barbershop, ultra realistic, intricate details, highly detailed, photorealistic, octane render, 8 k, unreal engine. art by artgerm and greg rutkowski and charlie bowater and magali villeneuve and alphonse mucha", "", 12, 75],
51
- ["Portrait of puggieace dog as a Roman Emperor, city in background, ultra realistic, intricate details, eerie, highly detailed, photorealistic, octane render, 8 k, unreal engine. art by artgerm and greg rutkowski and charlie bowater and magali villeneuve and alphonse mucha", "", 15, 75],
52
- ["Photo of cute puggieace dog as an astronaut, space and planet in background, ultra realistic, concept art, intricate details, highly detailed, photorealistic, octane render, 8 k, unreal engine. trending on artstation", "", 15, 75],
53
- ["Photo of cute puggieace dog as super hero, futuristic city in background, cinematic light, high dynamic range, insane intricate details, stunning cinema effects, aesthetic, masterpiece, trending on artstation, cartoon art", "", 12, 75],
54
  ]
55
 
56
  base_14 = "https://huggingface.co/nielsgl/dreambooth-pug-ace-sd1.4/resolve/main/"
57
  base_21 = "https://huggingface.co/nielsgl/dreambooth-keras-pug-ace-sd2.1/resolve/main/"
58
 
59
- model_card = f"""
60
  # KerasCV Stable Diffusion in Diffusers 🧨🤗
61
 
62
- DreamBooth model for the `puggieace` concept trained by nielsgl on the `nielsgl/dreambooth-ace` dataset.
63
  It can be used by modifying the `instance_prompt`: **a photo of puggieace**.
64
 
65
  The examples are from 2 different Keras CV models (`StableDiffusion` and `StableDiffusionV2`, corresponding to Stable Diffusion V1.4 and V2.1, respectively) trained on the same dataset (`nielsgl/dreambooth-ace`).
@@ -69,6 +69,11 @@ The examples are from 2 different Keras CV models (`StableDiffusion` and `Stable
69
  The Stable Diffusion V2 pipeline contained in the corresponding repository (`nielsgl/dreambooth-keras-pug-ace-sd2.1`) was created using a modified version of [this Space](https://huggingface.co/spaces/sayakpaul/convert-kerascv-sd-diffusers) for StableDiffusionV2 from KerasCV. The purpose is to convert the KerasCV Stable Diffusion weights in a way that is compatible with [Diffusers](https://github.com/huggingface/diffusers). This allows users to fine-tune using KerasCV and use the fine-tuned weights in Diffusers taking advantage of its nifty features (like [schedulers](https://huggingface.co/docs/diffusers/main/en/using-diffusers/schedulers), [fast attention](https://huggingface.co/docs/diffusers/optimization/fp16), etc.).
70
  This model was created as part of the Keras DreamBooth Sprint 🔥. Visit the [organisation page](https://huggingface.co/keras-dreambooth) for instructions on how to take part!
71
 
 
 
 
 
 
72
  ## Examples
73
 
74
  ### Stable Diffusion V1.4
@@ -158,15 +163,43 @@ The following hyperparameters were used during training for Stable Diffusion v1.
158
  | training_precision | float32 |
159
  """
160
 
161
- with gr.Blocks() as card_interface:
162
- gr.Markdown(model_card)
163
-
164
- demo_interface = gr.Interface(infer, inputs=[gr.Textbox(label="Positive Prompt", value="a photo of puggieace dog getting a haircut"),
165
- gr.Textbox(label="Negative Prompt", value="bad anatomy, blurry"),
166
- # gr.Slider(label='Number of gen image', minimum=1, maximum=4, value=2, step=1),
167
- gr.Number(label='Guidance scale', value=12),
168
- gr.Slider(label="Inference Steps",value=50),
169
- ], outputs=[output], title=title, description=description, examples=examples).queue()
170
-
171
-
172
- gr.TabbedInterface([card_interface, demo_interface], ["Model Card", "Demo 🤗"]).launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  description = "This is a dreambooth model fine-tuned on images of my pug named Ace. To try it, input the concept with `puggieace dog`."
48
  examples=[
49
  ["A photo of puggieace dog in space", "", 10, 50],
50
+ # ["A photo of a cute puggieace dog getting a haircut in a barbershop, ultra realistic, intricate details, highly detailed, photorealistic, octane render, 8 k, unreal engine. art by artgerm and greg rutkowski and charlie bowater and magali villeneuve and alphonse mucha", "", 12, 75],
51
+ # ["Portrait of puggieace dog as a Roman Emperor, city in background, ultra realistic, intricate details, eerie, highly detailed, photorealistic, octane render, 8 k, unreal engine. art by artgerm and greg rutkowski and charlie bowater and magali villeneuve and alphonse mucha", "", 15, 75],
52
+ # ["Photo of cute puggieace dog as an astronaut, space and planet in background, ultra realistic, concept art, intricate details, highly detailed, photorealistic, octane render, 8 k, unreal engine. trending on artstation", "", 15, 75],
53
+ # ["Photo of cute puggieace dog as super hero, futuristic city in background, cinematic light, high dynamic range, insane intricate details, stunning cinema effects, aesthetic, masterpiece, trending on artstation, cartoon art", "", 12, 75],
54
  ]
55
 
56
  base_14 = "https://huggingface.co/nielsgl/dreambooth-pug-ace-sd1.4/resolve/main/"
57
  base_21 = "https://huggingface.co/nielsgl/dreambooth-keras-pug-ace-sd2.1/resolve/main/"
58
 
59
+ model_card_1 = f"""
60
  # KerasCV Stable Diffusion in Diffusers 🧨🤗
61
 
62
+ DreamBooth model for the `puggieace` concept trained by nielsgl on the [nielsgl/dreambooth-ace](https://huggingface.co/datasets/nielsgl/dreambooth-ace) dataset.
63
  It can be used by modifying the `instance_prompt`: **a photo of puggieace**.
64
 
65
  The examples are from 2 different Keras CV models (`StableDiffusion` and `StableDiffusionV2`, corresponding to Stable Diffusion V1.4 and V2.1, respectively) trained on the same dataset (`nielsgl/dreambooth-ace`).
 
69
  The Stable Diffusion V2 pipeline contained in the corresponding repository (`nielsgl/dreambooth-keras-pug-ace-sd2.1`) was created using a modified version of [this Space](https://huggingface.co/spaces/sayakpaul/convert-kerascv-sd-diffusers) for StableDiffusionV2 from KerasCV. The purpose is to convert the KerasCV Stable Diffusion weights in a way that is compatible with [Diffusers](https://github.com/huggingface/diffusers). This allows users to fine-tune using KerasCV and use the fine-tuned weights in Diffusers taking advantage of its nifty features (like [schedulers](https://huggingface.co/docs/diffusers/main/en/using-diffusers/schedulers), [fast attention](https://huggingface.co/docs/diffusers/optimization/fp16), etc.).
70
  This model was created as part of the Keras DreamBooth Sprint 🔥. Visit the [organisation page](https://huggingface.co/keras-dreambooth) for instructions on how to take part!
71
 
72
+ ## Demo
73
+
74
+ """
75
+
76
+ model_card_2 = f"""
77
  ## Examples
78
 
79
  ### Stable Diffusion V1.4
 
163
  | training_precision | float32 |
164
  """
165
 
166
+ with gr.Blocks() as demo:
167
+ with gr.Row():
168
+ gr.Markdown(model_card_1)
169
+ with gr.Row():
170
+ # with gr.Column():
171
+ # prompt_pos = gr.Textbox(label="Positive Prompt", value="a photo of puggieace dog getting a haircut")
172
+ # prompt_neg = gr.Textbox(label="Negative Prompt", value="bad anatomy, blurry")
173
+ # # gr.Slider(label='Number of gen image', minimum=1, maximum=4, value=2, step=1),
174
+ # prompt_gs = gr.Number(label='Guidance scale', value=12)
175
+ # prompt_steps = gr.Slider(label="Inference Steps",value=50)
176
+ # prompt_btn = gr.Button("Generate")
177
+ # prompt_btn.click(infer, inputs=[prompt_pos, prompt_neg, prompt_gs, prompt_steps])
178
+ gr.Interface(infer, inputs=[gr.Textbox(label="Positive Prompt", value="a photo of puggieace dog getting a haircut"),
179
+ gr.Textbox(label="Negative Prompt", value="bad anatomy, blurry"),
180
+ # gr.Slider(label='Number of gen image', minimum=1, maximum=4, value=2, step=1),
181
+ gr.Number(label='Guidance scale', value=12),
182
+ gr.Slider(label="Inference Steps",value=50),
183
+ ], outputs=[output], title=title, description=description, examples=examples).queue()
184
+ with gr.Row():
185
+ with gr.Column():
186
+ gr.Markdown(model_card_2)
187
+ with gr.Column():
188
+ gr.Markdown(" ")
189
+
190
+ demo.launch()
191
+
192
+
193
+
194
+ # with gr.Blocks() as card_interface:
195
+ # gr.Markdown(model_card)
196
+
197
+ # demo_interface = gr.Interface(infer, inputs=[gr.Textbox(label="Positive Prompt", value="a photo of puggieace dog getting a haircut"),
198
+ # gr.Textbox(label="Negative Prompt", value="bad anatomy, blurry"),
199
+ # # gr.Slider(label='Number of gen image', minimum=1, maximum=4, value=2, step=1),
200
+ # gr.Number(label='Guidance scale', value=12),
201
+ # gr.Slider(label="Inference Steps",value=50),
202
+ # ], outputs=[output], title=title, description=description, examples=examples).queue()
203
+
204
+
205
+ # gr.TabbedInterface([card_interface, demo_interface], ["Model Card", "Demo 🤗"]).launch()