Spaces:
Runtime error
Runtime error
Fix the errors in the examples of url tab.
Browse files
app.py
CHANGED
|
@@ -100,13 +100,18 @@ def predict(
|
|
| 100 |
|
| 101 |
|
| 102 |
examples = [[_] for _ in glob('examples/*')][:]
|
| 103 |
-
|
| 104 |
# Add the option of resolution in a text box.
|
| 105 |
for idx_example, example in enumerate(examples):
|
| 106 |
examples[idx_example].append('1024x1024')
|
| 107 |
examples.append(examples[-1].copy())
|
| 108 |
examples[-1][1] = '512x512'
|
| 109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
tab_image = gr.Interface(
|
| 111 |
fn=predict,
|
| 112 |
inputs=[
|
|
@@ -127,7 +132,7 @@ tab_text = gr.Interface(
|
|
| 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=
|
| 131 |
api_name="text"
|
| 132 |
)
|
| 133 |
|
|
|
|
| 100 |
|
| 101 |
|
| 102 |
examples = [[_] for _ in glob('examples/*')][:]
|
|
|
|
| 103 |
# Add the option of resolution in a text box.
|
| 104 |
for idx_example, example in enumerate(examples):
|
| 105 |
examples[idx_example].append('1024x1024')
|
| 106 |
examples.append(examples[-1].copy())
|
| 107 |
examples[-1][1] = '512x512'
|
| 108 |
|
| 109 |
+
examples_url = [
|
| 110 |
+
['https://hips.hearstapps.com/hmg-prod/images/gettyimages-1229892983-square.jpg'],
|
| 111 |
+
]
|
| 112 |
+
for idx_example_url, example_url in enumerate(examples_url):
|
| 113 |
+
examples_url[idx_example_url].append('1024x1024')
|
| 114 |
+
|
| 115 |
tab_image = gr.Interface(
|
| 116 |
fn=predict,
|
| 117 |
inputs=[
|
|
|
|
| 132 |
gr.Radio(list(usage_to_weights_file.keys()), value='General', label="Weights", info="Choose the weights you want.")
|
| 133 |
],
|
| 134 |
outputs=ImageSlider(label="BiRefNet's prediction", type="pil"),
|
| 135 |
+
examples=examples_url,
|
| 136 |
api_name="text"
|
| 137 |
)
|
| 138 |
|