Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -46,8 +46,8 @@ def duplicate_horizontally(img):
|
|
| 46 |
mask = Image.open("mask_square.png")
|
| 47 |
|
| 48 |
@spaces.GPU
|
| 49 |
-
def generate(image, prompt_user, progress=gr.Progress(track_tqdm=True)):
|
| 50 |
-
prompt_structure = "The two-panel image showcases the logo on the left and the application on the right, [LEFT] the left panel is showing
|
| 51 |
prompt = prompt_structure + prompt_user
|
| 52 |
|
| 53 |
cropped_image = square_center_crop(image)
|
|
@@ -81,10 +81,13 @@ with gr.Blocks() as demo:
|
|
| 81 |
type="pil",
|
| 82 |
height=384
|
| 83 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
prompt_input = gr.Textbox(
|
| 85 |
label="Where should the logo be applied?",
|
| 86 |
-
placeholder="e.g., a coffee cup on a wooden table"
|
| 87 |
-
lines=2
|
| 88 |
)
|
| 89 |
generate_btn = gr.Button("Generate Application", variant="primary")
|
| 90 |
|
|
@@ -117,7 +120,7 @@ with gr.Blocks() as demo:
|
|
| 117 |
# Set up the click event
|
| 118 |
generate_btn.click(
|
| 119 |
fn=generate,
|
| 120 |
-
inputs=[input_image, prompt_input],
|
| 121 |
outputs=[output_image, output_side]
|
| 122 |
)
|
| 123 |
|
|
|
|
| 46 |
mask = Image.open("mask_square.png")
|
| 47 |
|
| 48 |
@spaces.GPU
|
| 49 |
+
def generate(image, prompt_description, prompt_user, progress=gr.Progress(track_tqdm=True)):
|
| 50 |
+
prompt_structure = "The two-panel image showcases the logo on the left and the application on the right, [LEFT] the left panel is showing "+prompt_description+" [RIGHT] this logo is applied to "
|
| 51 |
prompt = prompt_structure + prompt_user
|
| 52 |
|
| 53 |
cropped_image = square_center_crop(image)
|
|
|
|
| 81 |
type="pil",
|
| 82 |
height=384
|
| 83 |
)
|
| 84 |
+
prompt_description = gr.Textbox(
|
| 85 |
+
label="Describe your logo",
|
| 86 |
+
placeholder="A Hugging Face emoji logo",
|
| 87 |
+
)
|
| 88 |
prompt_input = gr.Textbox(
|
| 89 |
label="Where should the logo be applied?",
|
| 90 |
+
placeholder="e.g., a coffee cup on a wooden table"
|
|
|
|
| 91 |
)
|
| 92 |
generate_btn = gr.Button("Generate Application", variant="primary")
|
| 93 |
|
|
|
|
| 120 |
# Set up the click event
|
| 121 |
generate_btn.click(
|
| 122 |
fn=generate,
|
| 123 |
+
inputs=[input_image, prompt_description, prompt_input],
|
| 124 |
outputs=[output_image, output_side]
|
| 125 |
)
|
| 126 |
|