Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -24,7 +24,7 @@ del vae
|
|
24 |
|
25 |
pipe.force_zeros_for_empty_prompt = False
|
26 |
|
27 |
-
print("Optimizing BRIA 2.2
|
28 |
t=time.time()
|
29 |
pipe.unet = torch.compile(
|
30 |
pipe.unet, mode="reduce-overhead", fullgraph=True # 600 secs compilation
|
@@ -32,7 +32,9 @@ pipe.unet = torch.compile(
|
|
32 |
with torch.no_grad():
|
33 |
outputs = pipe(
|
34 |
prompt="an apple",
|
35 |
-
num_inference_steps=
|
|
|
|
|
36 |
)
|
37 |
|
38 |
# This will avoid future compilations on different shapes
|
@@ -66,7 +68,7 @@ def infer(prompt,seed,resolution):
|
|
66 |
|
67 |
w,h = resolution.split()
|
68 |
w,h = int(w),int(h)
|
69 |
-
image = pipe(prompt,num_inference_steps=
|
70 |
print(f'gen time is {time.time()-t} secs')
|
71 |
|
72 |
# Future
|
@@ -84,12 +86,12 @@ css = """
|
|
84 |
"""
|
85 |
with gr.Blocks(css=css) as demo:
|
86 |
with gr.Column(elem_id="col-container"):
|
87 |
-
gr.Markdown("## BRIA 2.2
|
88 |
gr.HTML('''
|
89 |
<p style="margin-bottom: 10px; font-size: 94%">
|
90 |
This is a demo for
|
91 |
-
<a href="https://huggingface.co/briaai/BRIA-2.2-
|
92 |
-
This is a
|
93 |
</p>
|
94 |
''')
|
95 |
with gr.Group():
|
@@ -98,7 +100,7 @@ with gr.Blocks(css=css) as demo:
|
|
98 |
resolution = gr.Dropdown(value=resolutions[0], show_label=True, label="Resolution", choices=resolutions)
|
99 |
seed = gr.Textbox(label="Seed", value=-1)
|
100 |
submit_btn = gr.Button("Generate")
|
101 |
-
result = gr.Image(label="BRIA 2.2
|
102 |
|
103 |
# gr.Examples(
|
104 |
# examples = [
|
|
|
24 |
|
25 |
pipe.force_zeros_for_empty_prompt = False
|
26 |
|
27 |
+
print("Optimizing BRIA 2.2 HR - this could take a while")
|
28 |
t=time.time()
|
29 |
pipe.unet = torch.compile(
|
30 |
pipe.unet, mode="reduce-overhead", fullgraph=True # 600 secs compilation
|
|
|
32 |
with torch.no_grad():
|
33 |
outputs = pipe(
|
34 |
prompt="an apple",
|
35 |
+
num_inference_steps=30,
|
36 |
+
width=1536,
|
37 |
+
height=1536
|
38 |
)
|
39 |
|
40 |
# This will avoid future compilations on different shapes
|
|
|
68 |
|
69 |
w,h = resolution.split()
|
70 |
w,h = int(w),int(h)
|
71 |
+
image = pipe(prompt,num_inference_steps=30,generator=generator,width=w,height=h).images[0]
|
72 |
print(f'gen time is {time.time()-t} secs')
|
73 |
|
74 |
# Future
|
|
|
86 |
"""
|
87 |
with gr.Blocks(css=css) as demo:
|
88 |
with gr.Column(elem_id="col-container"):
|
89 |
+
gr.Markdown("## BRIA 2.2 HR")
|
90 |
gr.HTML('''
|
91 |
<p style="margin-bottom: 10px; font-size: 94%">
|
92 |
This is a demo for
|
93 |
+
<a href="https://huggingface.co/briaai/BRIA-2.2-HR" target="_blank">BRIA 2.2 HR </a>.
|
94 |
+
This is a high resolution version of BRIA 2.2 text-to-image model, still trained on licensed data, and so provide full legal liability coverage for copyright and privacy infringement.
|
95 |
</p>
|
96 |
''')
|
97 |
with gr.Group():
|
|
|
100 |
resolution = gr.Dropdown(value=resolutions[0], show_label=True, label="Resolution", choices=resolutions)
|
101 |
seed = gr.Textbox(label="Seed", value=-1)
|
102 |
submit_btn = gr.Button("Generate")
|
103 |
+
result = gr.Image(label="BRIA 2.2 HR Result")
|
104 |
|
105 |
# gr.Examples(
|
106 |
# examples = [
|