Spaces:
Running
on
Zero
Running
on
Zero
Prime Cai
commited on
Commit
·
c90a6d7
1
Parent(s):
c3187f1
dynamic gpu
Browse files
app.py
CHANGED
@@ -39,8 +39,8 @@ def init_pipeline():
|
|
39 |
)
|
40 |
pipe.to(device, dtype=dtype)
|
41 |
|
42 |
-
|
43 |
-
def
|
44 |
w, h, min_size = image.size[0], image.size[1], min(image.size)
|
45 |
image = image.crop(
|
46 |
((w - min_size) // 2, (h - min_size) // 2, (w + min_size) // 2, (h + min_size) // 2)
|
@@ -119,7 +119,7 @@ with demo:
|
|
119 |
)
|
120 |
|
121 |
iface = gr.Interface(
|
122 |
-
fn=
|
123 |
inputs=[
|
124 |
gr.Image(type="pil"),
|
125 |
gr.Textbox(lines=2, label="text", info="Could be something as simple as 'this character playing soccer'."),
|
|
|
39 |
)
|
40 |
pipe.to(device, dtype=dtype)
|
41 |
|
42 |
+
@spaces.GPU
|
43 |
+
def generate_image(image, text, gemini_prompt, guidance, i_guidance, t_guidance):
|
44 |
w, h, min_size = image.size[0], image.size[1], min(image.size)
|
45 |
image = image.crop(
|
46 |
((w - min_size) // 2, (h - min_size) // 2, (w + min_size) // 2, (h + min_size) // 2)
|
|
|
119 |
)
|
120 |
|
121 |
iface = gr.Interface(
|
122 |
+
fn=generate_image,
|
123 |
inputs=[
|
124 |
gr.Image(type="pil"),
|
125 |
gr.Textbox(lines=2, label="text", info="Could be something as simple as 'this character playing soccer'."),
|