multimodalart HF Staff commited on
Commit
ab1f7ee
·
verified ·
1 Parent(s): 6885f6a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -9
app.py CHANGED
@@ -39,7 +39,7 @@ def duplicate_horizontally(img):
39
 
40
  new_image = Image.new('RGB', (width * 2, height))
41
  new_image.paste(img, (0, 0))
42
- new_image.paste(img, (width, 0))
43
  return new_image
44
 
45
  # Load the mask image
@@ -47,17 +47,15 @@ mask = Image.open("mask_square.png")
47
 
48
  def crop_input(image):
49
  cropped_image = square_center_crop(image)
50
- logo_dupli = duplicate_horizontally(cropped_image)
51
- return logo_dupli
52
 
53
  @spaces.GPU
54
  def generate(image, prompt_user, progress=gr.Progress(track_tqdm=True)):
55
  prompt_structure = "The two-panel image showcases the logo of a brand, [LEFT] the left panel is showing the logo [RIGHT] the right panel has this logo applied to "
56
  prompt = prompt_structure + prompt_user
57
-
58
- #cropped_image = square_center_crop(image)
59
- #logo_dupli = duplicate_horizontally(cropped_image)
60
-
61
  out = pipe(
62
  prompt=prompt,
63
  image=image,
@@ -91,8 +89,7 @@ with gr.Blocks() as demo:
91
  )
92
  prompt_input = gr.Textbox(
93
  label="Where should the logo be applied?",
94
- placeholder="e.g., a coffee cup on a wooden table",
95
- lines=2
96
  )
97
  generate_btn = gr.Button("Generate Application", variant="primary")
98
 
@@ -111,6 +108,7 @@ with gr.Blocks() as demo:
111
  fn=generate,
112
  cache_examples="lazy"
113
  )
 
114
  with gr.Row():
115
  gr.Markdown("""
116
  ### Instructions:
 
39
 
40
  new_image = Image.new('RGB', (width * 2, height))
41
  new_image.paste(img, (0, 0))
42
+ #new_image.paste(img, (width, 0))
43
  return new_image
44
 
45
  # Load the mask image
 
47
 
48
  def crop_input(image):
49
  cropped_image = square_center_crop(image)
50
+ return cropped_image
 
51
 
52
  @spaces.GPU
53
  def generate(image, prompt_user, progress=gr.Progress(track_tqdm=True)):
54
  prompt_structure = "The two-panel image showcases the logo of a brand, [LEFT] the left panel is showing the logo [RIGHT] the right panel has this logo applied to "
55
  prompt = prompt_structure + prompt_user
56
+
57
+ image = duplicate_horizontally(image)
58
+
 
59
  out = pipe(
60
  prompt=prompt,
61
  image=image,
 
89
  )
90
  prompt_input = gr.Textbox(
91
  label="Where should the logo be applied?",
92
+ placeholder="e.g., a coffee cup on a wooden table"
 
93
  )
94
  generate_btn = gr.Button("Generate Application", variant="primary")
95
 
 
108
  fn=generate,
109
  cache_examples="lazy"
110
  )
111
+
112
  with gr.Row():
113
  gr.Markdown("""
114
  ### Instructions: