Spaces:
Build error
Build error
testing secret
Browse files- app.py +13 -6
- requirements.txt +2 -1
app.py
CHANGED
|
@@ -5,7 +5,7 @@ import onnxruntime
|
|
| 5 |
import requests
|
| 6 |
from huggingface_hub import hf_hub_download
|
| 7 |
from PIL import Image
|
| 8 |
-
|
| 9 |
|
| 10 |
|
| 11 |
# Get x_scale_factor & y_scale_factor to resize image
|
|
@@ -34,16 +34,23 @@ def get_scale_factor(im_h, im_w, ref_size=512):
|
|
| 34 |
MODEL_PATH = hf_hub_download('huedaya/background-remover-files', 'modnet.onnx', repo_type='dataset')
|
| 35 |
|
| 36 |
|
| 37 |
-
def main(image_path, threshold):
|
| 38 |
-
|
| 39 |
-
# load secret
|
| 40 |
-
# apiKey = st.secrets["Api-Key"]
|
| 41 |
-
# print(apiKey)
|
| 42 |
|
| 43 |
# read image
|
| 44 |
im = cv2.imread(image_path)
|
| 45 |
im = cv2.cvtColor(im, cv2.COLOR_BGR2RGB)
|
| 46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
# unify image channels to 3
|
| 48 |
if len(im.shape) == 2:
|
| 49 |
im = im[:, :, None]
|
|
|
|
| 5 |
import requests
|
| 6 |
from huggingface_hub import hf_hub_download
|
| 7 |
from PIL import Image
|
| 8 |
+
import streamlit as st
|
| 9 |
|
| 10 |
|
| 11 |
# Get x_scale_factor & y_scale_factor to resize image
|
|
|
|
| 34 |
MODEL_PATH = hf_hub_download('huedaya/background-remover-files', 'modnet.onnx', repo_type='dataset')
|
| 35 |
|
| 36 |
|
| 37 |
+
def main(image_path, threshold, api):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
# read image
|
| 40 |
im = cv2.imread(image_path)
|
| 41 |
im = cv2.cvtColor(im, cv2.COLOR_BGR2RGB)
|
| 42 |
|
| 43 |
+
|
| 44 |
+
# load secret
|
| 45 |
+
apiKey = st.secrets["Api-Key"]
|
| 46 |
+
print(apiKey)
|
| 47 |
+
# if apiKey != api
|
| 48 |
+
# image = Image.open(image_path)
|
| 49 |
+
# image = np.asarray(image)
|
| 50 |
+
# Image.fromarray(foreground)
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
|
| 54 |
# unify image channels to 3
|
| 55 |
if len(im.shape) == 2:
|
| 56 |
im = im[:, :, None]
|
requirements.txt
CHANGED
|
@@ -2,4 +2,5 @@ onnxruntime==1.6.0
|
|
| 2 |
onnx
|
| 3 |
opencv-python
|
| 4 |
numpy
|
| 5 |
-
huggingface_hub
|
|
|
|
|
|
| 2 |
onnx
|
| 3 |
opencv-python
|
| 4 |
numpy
|
| 5 |
+
huggingface_hub
|
| 6 |
+
streamlit
|