Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,10 +12,10 @@ logging.set_verbosity_error()
|
|
| 12 |
|
| 13 |
#from helper import ignore_warnings
|
| 14 |
#ignore_warnings()
|
| 15 |
-
|
| 16 |
-
|
| 17 |
|
| 18 |
-
from
|
| 19 |
ignore_warnings()
|
| 20 |
|
| 21 |
# Import the pipeline function from the transformers library
|
|
@@ -26,7 +26,7 @@ pipe = pipeline("object-detection", model="facebook/detr-resnet-50")
|
|
| 26 |
|
| 27 |
#sys.path.append("./Open_Source_Models_with_Hugging_Face/Object_Detection/helper.py") # Adjust the path as necessary to point to the directory where helper.py is located
|
| 28 |
|
| 29 |
-
|
| 30 |
|
| 31 |
# Load the image from a file
|
| 32 |
#raw_image = Image.open('./Open_Source_Models_with_Hugging_Face/Object_Detection/kittens.jpeg')
|
|
@@ -43,7 +43,7 @@ def get_pipeline_prediction(pil_image):
|
|
| 43 |
processed_image = render_results_in_image(pil_image, pipeline_output)
|
| 44 |
return processed_image
|
| 45 |
|
| 46 |
-
|
| 47 |
fn=get_pipeline_prediction,
|
| 48 |
inputs=gr.Image(label="Input image",
|
| 49 |
type="pil"),
|
|
@@ -51,7 +51,15 @@ demo = gr.Interface(
|
|
| 51 |
type="pil")
|
| 52 |
)
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
-
demo.launch(share=True)
|
| 56 |
|
| 57 |
|
|
|
|
| 12 |
|
| 13 |
#from helper import ignore_warnings
|
| 14 |
#ignore_warnings()
|
| 15 |
+
import sys
|
| 16 |
+
sys.path.append("./Object-Detection/helper.py") # Adjust the path as necessary to point to the directory where helper.py is located
|
| 17 |
|
| 18 |
+
from Object-Detection.helper import ignore_warnings
|
| 19 |
ignore_warnings()
|
| 20 |
|
| 21 |
# Import the pipeline function from the transformers library
|
|
|
|
| 26 |
|
| 27 |
#sys.path.append("./Open_Source_Models_with_Hugging_Face/Object_Detection/helper.py") # Adjust the path as necessary to point to the directory where helper.py is located
|
| 28 |
|
| 29 |
+
from Object-Detection.helper import import load_image_from_url, render_results_in_image
|
| 30 |
|
| 31 |
# Load the image from a file
|
| 32 |
#raw_image = Image.open('./Open_Source_Models_with_Hugging_Face/Object_Detection/kittens.jpeg')
|
|
|
|
| 43 |
processed_image = render_results_in_image(pil_image, pipeline_output)
|
| 44 |
return processed_image
|
| 45 |
|
| 46 |
+
iface = gr.Interface(
|
| 47 |
fn=get_pipeline_prediction,
|
| 48 |
inputs=gr.Image(label="Input image",
|
| 49 |
type="pil"),
|
|
|
|
| 51 |
type="pil")
|
| 52 |
)
|
| 53 |
|
| 54 |
+
iface.launch()
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
|
| 63 |
|
|
|
|
| 64 |
|
| 65 |
|