Spaces:
Running
on
Zero
Running
on
Zero
Commit
•
b7d4359
1
Parent(s):
81b62f1
Update app.py
Browse files
app.py
CHANGED
@@ -44,7 +44,7 @@ def duplicate_horizontally(img):
|
|
44 |
mask = Image.open("mask_square.png")
|
45 |
|
46 |
@spaces.GPU
|
47 |
-
def generate(image, prompt_user):
|
48 |
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 "
|
49 |
prompt = prompt_structure + prompt_user
|
50 |
|
@@ -68,19 +68,6 @@ def generate(image, prompt_user):
|
|
68 |
image_2 = out.crop((half_width, 0, width, height))
|
69 |
return image_2
|
70 |
|
71 |
-
def process_image(input_image, prompt):
|
72 |
-
try:
|
73 |
-
if input_image is None:
|
74 |
-
return None, "Please upload an image first."
|
75 |
-
|
76 |
-
if not prompt:
|
77 |
-
return None, "Please provide a prompt."
|
78 |
-
|
79 |
-
result = generate(input_image, prompt)
|
80 |
-
return result, "Generation completed successfully!"
|
81 |
-
except Exception as e:
|
82 |
-
return None, f"Error during generation: {str(e)}"
|
83 |
-
|
84 |
with gr.Blocks() as demo:
|
85 |
gr.Markdown("# Logo in Context")
|
86 |
gr.Markdown("### In-Context LoRA + Image-to-Image, apply your logo to anything")
|
@@ -101,10 +88,6 @@ with gr.Blocks() as demo:
|
|
101 |
|
102 |
with gr.Column():
|
103 |
output_image = gr.Image(label="Generated Application")
|
104 |
-
status_text = gr.Textbox(
|
105 |
-
label="Status",
|
106 |
-
interactive=False
|
107 |
-
)
|
108 |
|
109 |
with gr.Row():
|
110 |
gr.Markdown("""
|
@@ -118,7 +101,7 @@ with gr.Blocks() as demo:
|
|
118 |
|
119 |
# Set up the click event
|
120 |
generate_btn.click(
|
121 |
-
fn=
|
122 |
inputs=[input_image, prompt_input],
|
123 |
outputs=[output_image]
|
124 |
)
|
|
|
44 |
mask = Image.open("mask_square.png")
|
45 |
|
46 |
@spaces.GPU
|
47 |
+
def generate(image, prompt_user, progress=gr.Progress(track_tqdm=True)):
|
48 |
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 "
|
49 |
prompt = prompt_structure + prompt_user
|
50 |
|
|
|
68 |
image_2 = out.crop((half_width, 0, width, height))
|
69 |
return image_2
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
with gr.Blocks() as demo:
|
72 |
gr.Markdown("# Logo in Context")
|
73 |
gr.Markdown("### In-Context LoRA + Image-to-Image, apply your logo to anything")
|
|
|
88 |
|
89 |
with gr.Column():
|
90 |
output_image = gr.Image(label="Generated Application")
|
|
|
|
|
|
|
|
|
91 |
|
92 |
with gr.Row():
|
93 |
gr.Markdown("""
|
|
|
101 |
|
102 |
# Set up the click event
|
103 |
generate_btn.click(
|
104 |
+
fn=generate,
|
105 |
inputs=[input_image, prompt_input],
|
106 |
outputs=[output_image]
|
107 |
)
|