zenafey commited on
Commit
690a721
1 Parent(s): 4393e60

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -10,6 +10,7 @@ DEFAULT_STYLE_NAME = "Photographic (Default)"
10
 
11
 
12
  def generate_image(upload_images, prompt, negative_prompt, style_name, steps, progress=gr.Progress(track_tqdm=True)):
 
13
  p, n = apply_style(style_name, prompt, negative_prompt)
14
 
15
  job = prodia.create("/photomaker",
@@ -23,6 +24,11 @@ def generate_image(upload_images, prompt, negative_prompt, style_name, steps, pr
23
  return result.image_url
24
 
25
 
 
 
 
 
 
26
  def swap_to_gallery(images):
27
  return gr.update(value=images, visible=True), gr.update(visible=True), gr.update(visible=False)
28
 
 
10
 
11
 
12
  def generate_image(upload_images, prompt, negative_prompt, style_name, steps, progress=gr.Progress(track_tqdm=True)):
13
+ error_if_no_img(prompt)
14
  p, n = apply_style(style_name, prompt, negative_prompt)
15
 
16
  job = prodia.create("/photomaker",
 
24
  return result.image_url
25
 
26
 
27
+ def error_if_no_img(prompt):
28
+ raise gr.Error("test") if ("img" not in prompt)
29
+
30
+
31
+
32
  def swap_to_gallery(images):
33
  return gr.update(value=images, visible=True), gr.update(visible=True), gr.update(visible=False)
34