prithivMLmods commited on
Commit
1b63cf9
1 Parent(s): c9fdc92

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -15
app.py CHANGED
@@ -7,9 +7,10 @@ import uuid
7
  import gradio as gr
8
  import numpy as np
9
  from PIL import Image
 
 
10
  import torch
11
  from diffusers import StableCascadeDecoderPipeline, StableCascadePriorPipeline
12
- from typing import Tuple
13
 
14
  DESCRIPTION = """ """
15
 
@@ -38,19 +39,19 @@ style_list = [
38
  "negative_prompt": "",
39
  },
40
  {
41
- "name": "3840 x 2160",
42
- "prompt": "hyper-realistic 8K image of {prompt} . ultra-detailed, lifelike, high-resolution, sharp, vibrant colors, photorealistic",
43
- "negative_prompt": "cartoonish, low resolution, blurry, simplistic, abstract, deformed, ugly",
44
  },
45
  {
46
- "name": "2560 × 1440",
47
- "prompt": "hyper-realistic 4K image of {prompt} . ultra-detailed, lifelike, high-resolution, sharp, vibrant colors, photorealistic",
48
- "negative_prompt": "cartoonish, low resolution, blurry, simplistic, abstract, deformed, ugly",
49
  },
50
  {
51
- "name": "HDR",
52
- "prompt": "HDR photo of {prompt} . high dynamic range, vivid colors, sharp contrast, realistic, detailed, high resolution, professional",
53
- "negative_prompt": "dull, low contrast, blurry, unrealistic, cartoonish, ugly, deformed",
54
  },
55
  {
56
  "name": "Cinematic",
@@ -94,6 +95,7 @@ def apply_style(style_name: str, positive: str, negative: str = "") -> Tuple[str
94
  negative = ""
95
  return p.replace("{prompt}", positive), n + negative
96
 
 
97
  def stab(
98
  prompt: str,
99
  negative_prompt: str = "",
@@ -169,7 +171,7 @@ with gr.Blocks(css=css, theme="xiaobaiyuan/theme_brief") as demo:
169
 
170
  with gr.Group():
171
  with gr.Row():
172
- prompt = gr.Textbox(
173
  label="Prompt",
174
  show_label=False,
175
  max_lines=1,
@@ -179,12 +181,11 @@ with gr.Blocks(css=css, theme="xiaobaiyuan/theme_brief") as demo:
179
  run_button = gr.Button("Run")
180
  result = gr.Gallery(label="Result", columns=1, preview=True)
181
  with gr.Accordion("Advanced options", open=False):
182
- use_negative_prompt = gr.Checkbox(label="Use negative prompt", value=True)
183
- negative_prompt = gr.Textbox(
184
  label="Negative prompt",
185
- max_lines=5,
186
  placeholder="Enter a negative prompt",
187
- value="(deformed, distorted, disfigured:1.3), poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, (mutated hands and fingers:1.4), disconnected limbs, mutation, mutated, ugly, disgusting, blurry, amputation, NSFW",
188
  visible=True,
189
  )
190
  with gr.Row():
 
7
  import gradio as gr
8
  import numpy as np
9
  from PIL import Image
10
+ import spaces
11
+ from typing import Tuple
12
  import torch
13
  from diffusers import StableCascadeDecoderPipeline, StableCascadePriorPipeline
 
14
 
15
  DESCRIPTION = """ """
16
 
 
39
  "negative_prompt": "",
40
  },
41
  {
42
+ "name": "3840 x 2160",
43
+ "prompt": "hyper-realistic 8K image of {prompt} . ultra-detailed, lifelike, high-resolution, sharp, vibrant colors, photorealistic",
44
+ "negative_prompt": "cartoonish, low resolution, blurry, simplistic, abstract, deformed, ugly",
45
  },
46
  {
47
+ "name": "2560 × 1440",
48
+ "prompt": "hyper-realistic 4K image of {prompt} . ultra-detailed, lifelike, high-resolution, sharp, vibrant colors, photorealistic",
49
+ "negative_prompt": "cartoonish, low resolution, blurry, simplistic, abstract, deformed, ugly",
50
  },
51
  {
52
+ "name": "HDR",
53
+ "prompt": "HDR photo of {prompt} . high dynamic range, vivid colors, sharp contrast, realistic, detailed, high resolution, professional",
54
+ "negative_prompt": "dull, low contrast, blurry, unrealistic, cartoonish, ugly, deformed",
55
  },
56
  {
57
  "name": "Cinematic",
 
95
  negative = ""
96
  return p.replace("{prompt}", positive), n + negative
97
 
98
+ @spaces.GPU(enable_queue=True)
99
  def stab(
100
  prompt: str,
101
  negative_prompt: str = "",
 
171
 
172
  with gr.Group():
173
  with gr.Row():
174
+ prompt = gr.Text(
175
  label="Prompt",
176
  show_label=False,
177
  max_lines=1,
 
181
  run_button = gr.Button("Run")
182
  result = gr.Gallery(label="Result", columns=1, preview=True)
183
  with gr.Accordion("Advanced options", open=False):
184
+ use_negative_prompt = gr.Checkbox(label="Use negative prompt", value=False, visible=True)
185
+ negative_prompt = gr.Text(
186
  label="Negative prompt",
187
+ max_lines=1,
188
  placeholder="Enter a negative prompt",
 
189
  visible=True,
190
  )
191
  with gr.Row():