Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -265,7 +265,7 @@ def submit_comment(comment):
|
|
| 265 |
clear_botton = gr.Button("Clear comments", interactive=len(comments) != 0)
|
| 266 |
|
| 267 |
return (gr.Image(value=comment_images[0], label=f"image {image_index+1}/{len(comment_images)}", show_label=True),
|
| 268 |
-
gr.Text(label="Comment", show_label=False, lines=
|
| 269 |
gr.Button(f"Extract visual preference from {len(comments)} comments", interactive=len(comments) != 0, variant="primary"),
|
| 270 |
clear_botton
|
| 271 |
)
|
|
@@ -282,7 +282,7 @@ def next_image():
|
|
| 282 |
|
| 283 |
image_index = (image_index + 1) % len(comment_images)
|
| 284 |
|
| 285 |
-
return gr.Image(value=comment_images[0], label=f"image {image_index+1}/{len(comment_images)}", show_label=True), gr.Text(label="Comment", show_label=False, lines=
|
| 286 |
|
| 287 |
def previous_image():
|
| 288 |
global comment_images, image_index
|
|
@@ -298,7 +298,7 @@ def previous_image():
|
|
| 298 |
|
| 299 |
image_index = (image_index - 1) % len(comment_images)
|
| 300 |
|
| 301 |
-
return gr.Image(value=comment_images[0], label=f"image {image_index+1}/{len(comment_images)}", show_label=True), gr.Text(label="Comment", show_label=False, lines=
|
| 302 |
|
| 303 |
def clear_comments():
|
| 304 |
comments.clear()
|
|
@@ -534,7 +534,7 @@ def upload_file(files):
|
|
| 534 |
comment_images = [file_path] + comment_images
|
| 535 |
|
| 536 |
next_comment = ""
|
| 537 |
-
return gr.Image(value=comment_images[0], label=f"image {image_index+1}/{len(comment_images)}", show_label=True), gr.Text(label="Comment", show_label=False, lines=
|
| 538 |
|
| 539 |
def next_prompt():
|
| 540 |
global example_prompts, examples
|
|
@@ -666,7 +666,7 @@ with gr.Blocks(css=css, title="ViPer Demo", theme=gr.themes.Base()) as demo:
|
|
| 666 |
|
| 667 |
gr.Markdown(f"""
|
| 668 |
## Step 2: Personalized image generation (using Stable Diffusion XL)
|
| 669 |
-
Generate personalized images using the visual preference extracted from your comments by entering a prompt below!
|
| 670 |
""")
|
| 671 |
|
| 672 |
slider = gr.Slider(value=0.85, minimum=0, maximum=1.5, label="Personalization degree", interactive=True)
|
|
|
|
| 265 |
clear_botton = gr.Button("Clear comments", interactive=len(comments) != 0)
|
| 266 |
|
| 267 |
return (gr.Image(value=comment_images[0], label=f"image {image_index+1}/{len(comment_images)}", show_label=True),
|
| 268 |
+
gr.Text(label="Comment", show_label=False, lines=4, max_lines=5, placeholder="Enter your comment. The more detailed the better.", value=next_comment, container=False),
|
| 269 |
gr.Button(f"Extract visual preference from {len(comments)} comments", interactive=len(comments) != 0, variant="primary"),
|
| 270 |
clear_botton
|
| 271 |
)
|
|
|
|
| 282 |
|
| 283 |
image_index = (image_index + 1) % len(comment_images)
|
| 284 |
|
| 285 |
+
return gr.Image(value=comment_images[0], label=f"image {image_index+1}/{len(comment_images)}", show_label=True), gr.Text(label="Comment", show_label=False, lines=4, max_lines=5, placeholder="Enter your comment. The more detailed the better.", value=next_comment, container=False)
|
| 286 |
|
| 287 |
def previous_image():
|
| 288 |
global comment_images, image_index
|
|
|
|
| 298 |
|
| 299 |
image_index = (image_index - 1) % len(comment_images)
|
| 300 |
|
| 301 |
+
return gr.Image(value=comment_images[0], label=f"image {image_index+1}/{len(comment_images)}", show_label=True), gr.Text(label="Comment", show_label=False, lines=4, max_lines=5, placeholder="Enter your comment. The more detailed the better.", value=next_comment, container=False)
|
| 302 |
|
| 303 |
def clear_comments():
|
| 304 |
comments.clear()
|
|
|
|
| 534 |
comment_images = [file_path] + comment_images
|
| 535 |
|
| 536 |
next_comment = ""
|
| 537 |
+
return gr.Image(value=comment_images[0], label=f"image {image_index+1}/{len(comment_images)}", show_label=True), gr.Text(label="Comment", show_label=False, lines=4, max_lines=5, placeholder="Enter your comment. The more detailed the better.", value=next_comment, container=False)
|
| 538 |
|
| 539 |
def next_prompt():
|
| 540 |
global example_prompts, examples
|
|
|
|
| 666 |
|
| 667 |
gr.Markdown(f"""
|
| 668 |
## Step 2: Personalized image generation (using Stable Diffusion XL)
|
| 669 |
+
Generate personalized images using the visual preference extracted from your comments by entering a prompt below! You can adjust the personalization degree to generate results that are more or less personalized and diverse.
|
| 670 |
""")
|
| 671 |
|
| 672 |
slider = gr.Slider(value=0.85, minimum=0, maximum=1.5, label="Personalization degree", interactive=True)
|