Spaces:
Build error
Build error
use Blocks
Browse files
app.py
CHANGED
|
@@ -174,7 +174,7 @@ def reset_inference_state():
|
|
| 174 |
torch.cuda.empty_cache()
|
| 175 |
gc.collect()
|
| 176 |
|
| 177 |
-
def infer(
|
| 178 |
global models_rbm, models_b
|
| 179 |
try:
|
| 180 |
height=1024
|
|
@@ -274,8 +274,31 @@ def infer(style_description, ref_style_file, caption):
|
|
| 274 |
|
| 275 |
import gradio as gr
|
| 276 |
|
| 277 |
-
gr.
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 174 |
torch.cuda.empty_cache()
|
| 175 |
gc.collect()
|
| 176 |
|
| 177 |
+
def infer(ref_style_file, style_description, caption):
|
| 178 |
global models_rbm, models_b
|
| 179 |
try:
|
| 180 |
height=1024
|
|
|
|
| 274 |
|
| 275 |
import gradio as gr
|
| 276 |
|
| 277 |
+
with gr.Blocks() as demo:
|
| 278 |
+
with gr.Column():
|
| 279 |
+
gr.Mardown("# RB-Modulation")
|
| 280 |
+
with gr.Row():
|
| 281 |
+
style_reference_image = gr.Image(
|
| 282 |
+
label = "Style Reference Image",
|
| 283 |
+
type = "filepath"
|
| 284 |
+
)
|
| 285 |
+
style_description = gr.Textbox(
|
| 286 |
+
label ="Style Description"
|
| 287 |
+
)
|
| 288 |
+
subject_prompt = gr.Textbox(
|
| 289 |
+
label = "Subject Prompt"
|
| 290 |
+
)
|
| 291 |
+
with gr.Accordion("Advanced Settings", open=False):
|
| 292 |
+
subject_reference = gr.Image(type="filepath")
|
| 293 |
+
use_subject_ref = gr.Checkbox(label="Use Subject Image as Reference", value=False)
|
| 294 |
+
submit_btn = gr.Button("Submit")
|
| 295 |
+
with gr.Row():
|
| 296 |
+
output_image = gr.Image(label="Output Image")
|
| 297 |
+
|
| 298 |
+
submit_btn.click(
|
| 299 |
+
fn = infer,
|
| 300 |
+
inputs = [style_reference_image, style_description, subject_prompt],
|
| 301 |
+
outputs = [output_image]
|
| 302 |
+
)
|
| 303 |
+
|
| 304 |
+
demo.launch()
|