fffiloni commited on
Commit
c718918
1 Parent(s): cb4eb0e

use Blocks

Browse files
Files changed (1) hide show
  1. app.py +29 -6
app.py CHANGED
@@ -174,7 +174,7 @@ def reset_inference_state():
174
  torch.cuda.empty_cache()
175
  gc.collect()
176
 
177
- def infer(style_description, ref_style_file, caption):
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.Interface(
278
- fn = infer,
279
- inputs=[gr.Textbox(label="style description"), gr.Image(label="Ref Style File", type="filepath"), gr.Textbox(label="caption")],
280
- outputs=[gr.Image()]
281
- ).launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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()