fffiloni commited on
Commit
01849e6
·
1 Parent(s): a41ccb6

Added mode options

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -19,20 +19,21 @@ def get_images(prompt):
19
  return img_results[0]
20
 
21
  def get_new_prompt(img):
22
- interrogate = clip_interrogator_2(img, 'fast', 12, api_name="clipi2")
23
  #print(interrogate)
24
  return interrogate
25
 
26
- def infer(prompt):
27
  img = get_images(prompt)
28
 
29
- result = get_new_prompt(img)
30
  #print(result)
31
  return result[0]
32
 
33
  prompt_input = gr.Textbox(lines=4, label="Input v1.x Stable Diffusion prompt")
 
34
  prompt_output = gr.Textbox(lines=4, label="Converted v2.x Stable Diffusion prompt")
35
  examples=["girl with steampunk weapons and uniform, serious, finely detailed, made by wlop, boichi, ilya kuvshinov, full body portrait, illustration, grass, sunny, sky, anime, side view, perfect anime face, detailed face, zoomed out, smooth, ",
36
  "a yellow cockatiel riding on the rings of saturn wearing a propeller hat, fantasy, intricate, elegant, highly detailed, digital painting, artstation, concept art, smooth, sharp focus, illustration, art by artgerm and greg rutkowski and alphonse mucha ",
37
  "painting, view from inside edward hopper's painting nighthawks, of a group of werebears robbing a bank, foggy "]
38
- gr.Interface(fn=infer, inputs=[prompt_input], outputs=[prompt_output],title=title,description=description,examples=examples).queue(max_size=10).launch(enable_queue=True)
 
19
  return img_results[0]
20
 
21
  def get_new_prompt(img):
22
+ interrogate = clip_interrogator_2(img, mode, 12, api_name="clipi2")
23
  #print(interrogate)
24
  return interrogate
25
 
26
+ def infer(prompt, mode):
27
  img = get_images(prompt)
28
 
29
+ result = get_new_prompt(img, mode)
30
  #print(result)
31
  return result[0]
32
 
33
  prompt_input = gr.Textbox(lines=4, label="Input v1.x Stable Diffusion prompt")
34
+ mode_input = gr.Radio(['best', 'classic', 'fast'], label='', value='fast')
35
  prompt_output = gr.Textbox(lines=4, label="Converted v2.x Stable Diffusion prompt")
36
  examples=["girl with steampunk weapons and uniform, serious, finely detailed, made by wlop, boichi, ilya kuvshinov, full body portrait, illustration, grass, sunny, sky, anime, side view, perfect anime face, detailed face, zoomed out, smooth, ",
37
  "a yellow cockatiel riding on the rings of saturn wearing a propeller hat, fantasy, intricate, elegant, highly detailed, digital painting, artstation, concept art, smooth, sharp focus, illustration, art by artgerm and greg rutkowski and alphonse mucha ",
38
  "painting, view from inside edward hopper's painting nighthawks, of a group of werebears robbing a bank, foggy "]
39
+ gr.Interface(fn=infer, inputs=[prompt_input,mode_input], outputs=[prompt_output],title=title,description=description,examples=examples).queue(max_size=10).launch(enable_queue=True)