Rooni commited on
Commit
52c5bd8
·
verified ·
1 Parent(s): 9edfb9c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -12
app.py CHANGED
@@ -53,18 +53,23 @@ def process_image_and_text(image, text):
53
  # Возврат результата
54
  return result['path']
55
 
56
- # Интерфейс Gradio
57
- demo = gr.Interface(
58
- fn=process_image_and_text,
59
- inputs=[
60
- gr.Image(type="pil"),
61
- gr.Textbox(lines=2),
62
- ],
63
- outputs=gr.Image(type="pil", show_share_button=False),
64
- title="OminiControl / Subject driven generation",
65
- css=css,
66
- concurrency_limit=250
67
- )
 
 
 
 
 
68
 
69
  # Запуск интерфейса
70
  if __name__ == "__main__":
 
53
  # Возврат результата
54
  return result['path']
55
 
56
+ # Интерфейс Gradio с использованием gr.Blocks
57
+ with gr.Blocks(css=css) as demo:
58
+ gr.Markdown("# Замена фона")
59
+ with gr.Row():
60
+ with gr.Column():
61
+ image_input = gr.Image(type="pil", label="Входное изображение")
62
+ text_input = gr.Textbox(lines=2, label="Описание")
63
+ submit_button = gr.Button("Обработать")
64
+ with gr.Column():
65
+ output_image = gr.Image(type="pil", label="Результат", show_share_button=False)
66
+
67
+ submit_button.click(
68
+ fn=process_image_and_text,
69
+ inputs=[image_input, text_input],
70
+ outputs=output_image,
71
+ concurrency_limit=250
72
+ )
73
 
74
  # Запуск интерфейса
75
  if __name__ == "__main__":