Spaces:
Runtime error
Runtime error
yourusername
commited on
Commit
β’
d93c5fc
1
Parent(s):
16a2aff
:bug: fix missing example img bug
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ import cv2
|
|
2 |
import gradio as gr
|
3 |
import numpy as np
|
4 |
import onnxruntime
|
|
|
5 |
from huggingface_hub import hf_hub_download
|
6 |
from PIL import Image
|
7 |
|
@@ -93,18 +94,14 @@ title = "MODNet Background Remover"
|
|
93 |
description = "Gradio demo for MODNet, a model that can remove the background from a given image. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below."
|
94 |
article = "<div style='text-align: center;'> <a href='https://github.com/ZHKKKe/MODNet' target='_blank'>Github Repo</a> | <a href='https://arxiv.org/abs/2011.11961' target='_blank'>MODNet: Real-Time Trimap-Free Portrait Matting via Objective Decomposition</a> </div>"
|
95 |
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
repo_type='dataset',
|
100 |
-
force_filename='twitter_profile_pic.jpeg',
|
101 |
-
)
|
102 |
-
|
103 |
interface = gr.Interface(
|
104 |
fn=main,
|
105 |
inputs=gr.inputs.Image(type='filepath'),
|
106 |
outputs='image',
|
107 |
-
examples=[[
|
108 |
title=title,
|
109 |
description=description,
|
110 |
article=article,
|
|
|
2 |
import gradio as gr
|
3 |
import numpy as np
|
4 |
import onnxruntime
|
5 |
+
import requests
|
6 |
from huggingface_hub import hf_hub_download
|
7 |
from PIL import Image
|
8 |
|
|
|
94 |
description = "Gradio demo for MODNet, a model that can remove the background from a given image. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below."
|
95 |
article = "<div style='text-align: center;'> <a href='https://github.com/ZHKKKe/MODNet' target='_blank'>Github Repo</a> | <a href='https://arxiv.org/abs/2011.11961' target='_blank'>MODNet: Real-Time Trimap-Free Portrait Matting via Objective Decomposition</a> </div>"
|
96 |
|
97 |
+
url = "https://huggingface.co/datasets/nateraw/background-remover-files/resolve/main/twitter_profile_pic.jpeg"
|
98 |
+
image = Image.open(requests.get(url, stream=True).raw)
|
99 |
+
image.save('twitter_profile_pic.jpeg')
|
|
|
|
|
|
|
|
|
100 |
interface = gr.Interface(
|
101 |
fn=main,
|
102 |
inputs=gr.inputs.Image(type='filepath'),
|
103 |
outputs='image',
|
104 |
+
examples=[['twitter_profile_pic.jpeg']],
|
105 |
title=title,
|
106 |
description=description,
|
107 |
article=article,
|