ZhengPeng7 commited on
Commit
9430ab7
·
verified ·
1 Parent(s): 1acca69

Make the option of model and resolution available to both image and url inference tab.

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -121,7 +121,11 @@ tab_image = gr.Interface(
121
 
122
  tab_text = gr.Interface(
123
  fn=predict,
124
- inputs=gr.Textbox(label="Paste an image URL"),
 
 
 
 
125
  outputs=ImageSlider(label="BiRefNet's prediction", type="pil"),
126
  examples=["https://hips.hearstapps.com/hmg-prod/images/gettyimages-1229892983-square.jpg"],
127
  api_name="text"
@@ -130,7 +134,7 @@ tab_text = gr.Interface(
130
  demo = gr.TabbedInterface(
131
  [tab_image, tab_text],
132
  ["image", "text"],
133
- title="BiRefNet demo for subject extraction (general / salient / camouflaged / portrait)."
134
  description=('Upload a picture, our model will extract a highly accurate segmentation of the subject in it.\n)'
135
  ' The resolution used in our training was `1024x1024`, thus the suggested resolution to obtain good results!\n'
136
  ' Our codes can be found at https://github.com/ZhengPeng7/BiRefNet.\n'
 
121
 
122
  tab_text = gr.Interface(
123
  fn=predict,
124
+ inputs=[
125
+ gr.Textbox(label="Paste an image URL"),
126
+ gr.Textbox(lines=1, placeholder="Type the resolution (`WxH`) you want, e.g., `1024x1024`. Higher resolutions can be much slower for inference.", label="Resolution"),
127
+ gr.Radio(list(usage_to_weights_file.keys()), value='General', label="Weights", info="Choose the weights you want.")
128
+ ]
129
  outputs=ImageSlider(label="BiRefNet's prediction", type="pil"),
130
  examples=["https://hips.hearstapps.com/hmg-prod/images/gettyimages-1229892983-square.jpg"],
131
  api_name="text"
 
134
  demo = gr.TabbedInterface(
135
  [tab_image, tab_text],
136
  ["image", "text"],
137
+ title="BiRefNet demo for subject extraction (general / salient / camouflaged / portrait).",
138
  description=('Upload a picture, our model will extract a highly accurate segmentation of the subject in it.\n)'
139
  ' The resolution used in our training was `1024x1024`, thus the suggested resolution to obtain good results!\n'
140
  ' Our codes can be found at https://github.com/ZhengPeng7/BiRefNet.\n'