Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,8 @@
|
|
1 |
from __future__ import annotations
|
2 |
|
|
|
|
|
|
|
3 |
import gradio as gr
|
4 |
import torch
|
5 |
from PIL import Image, ImageOps
|
@@ -64,7 +67,7 @@ def main():
|
|
64 |
|
65 |
generator = torch.manual_seed(seed)
|
66 |
edited_image = pipe(
|
67 |
-
instruction,
|
68 |
guidance_scale=text_cfg_scale, image_guidance_scale=image_cfg_scale,
|
69 |
num_inference_steps=steps, generator=generator,
|
70 |
).images[0]
|
@@ -86,7 +89,11 @@ def main():
|
|
86 |
reset_button = gr.Button("Reset")
|
87 |
with gr.Column(scale=3):
|
88 |
instruction = gr.Textbox(lines=1, label="Edit Instruction", interactive=True)
|
89 |
-
|
|
|
|
|
|
|
|
|
90 |
with gr.Row():
|
91 |
steps = gr.Number(value=50, precision=0, label="Steps", interactive=True)
|
92 |
randomize_seed = gr.Radio(
|
|
|
1 |
from __future__ import annotations
|
2 |
|
3 |
+
import math
|
4 |
+
import random
|
5 |
+
|
6 |
import gradio as gr
|
7 |
import torch
|
8 |
from PIL import Image, ImageOps
|
|
|
67 |
|
68 |
generator = torch.manual_seed(seed)
|
69 |
edited_image = pipe(
|
70 |
+
instruction,
|
71 |
guidance_scale=text_cfg_scale, image_guidance_scale=image_cfg_scale,
|
72 |
num_inference_steps=steps, generator=generator,
|
73 |
).images[0]
|
|
|
89 |
reset_button = gr.Button("Reset")
|
90 |
with gr.Column(scale=3):
|
91 |
instruction = gr.Textbox(lines=1, label="Edit Instruction", interactive=True)
|
92 |
+
with gr.Row():
|
93 |
+
|
94 |
+
edited_image = gr.Image(label=f"Edited Image", type="pil", interactive=False)
|
95 |
+
|
96 |
+
edited_image.style(height=512, width=512)
|
97 |
with gr.Row():
|
98 |
steps = gr.Number(value=50, precision=0, label="Steps", interactive=True)
|
99 |
randomize_seed = gr.Radio(
|