Update app.py
Browse files
app.py
CHANGED
@@ -64,7 +64,7 @@ def get_original_image(url_input):
|
|
64 |
image = Image.open(requests.get(url_input, stream=True).raw)
|
65 |
return image
|
66 |
|
67 |
-
def detect_objects(model_name, url_input, image_input,
|
68 |
# Extract model and feature extractor
|
69 |
feature_extractor = AutoFeatureExtractor.from_pretrained(model_name)
|
70 |
|
@@ -77,8 +77,6 @@ def detect_objects(model_name, url_input, image_input, webcam_input, threshold):
|
|
77 |
image = get_original_image(url_input)
|
78 |
elif image_input is not None:
|
79 |
image = image_input
|
80 |
-
elif webcam_input is not None:
|
81 |
-
image = webcam_input
|
82 |
|
83 |
# Make prediction
|
84 |
processed_outputs = make_prediction(image, feature_extractor, model)
|
@@ -103,9 +101,6 @@ models = ["nickmuchi/yolos-small-finetuned-license-plate-detection", "nickmuchi/
|
|
103 |
urls = ["https://drive.google.com/uc?id=1j9VZQ4NDS4gsubFf3m2qQoTMWLk552bQ", "https://drive.google.com/uc?id=1p9wJIqRz3W50e2f_A0D8ftla8hoXz4T5"]
|
104 |
images = [[path.as_posix()] for path in sorted(pathlib.Path('images').rglob('*.j*g'))]
|
105 |
|
106 |
-
twitter_link = """
|
107 |
-
[](https://twitter.com/nickmuchi)
|
108 |
-
"""
|
109 |
|
110 |
css = '''
|
111 |
h1#title {
|
@@ -150,6 +145,6 @@ with demo:
|
|
150 |
url_but.click(fn=detect_objects, inputs=[options, url_input, img_input, slider_input], outputs=[img_output_from_url], queue=True)
|
151 |
img_but.click(fn=detect_objects, inputs=[options, url_input, img_input, slider_input], outputs=[img_output_from_upload], queue=True)
|
152 |
|
153 |
-
gr.Markdown("")
|
154 |
|
155 |
demo.launch(debug=True)
|
|
|
64 |
image = Image.open(requests.get(url_input, stream=True).raw)
|
65 |
return image
|
66 |
|
67 |
+
def detect_objects(model_name, url_input, image_input,threshold):
|
68 |
# Extract model and feature extractor
|
69 |
feature_extractor = AutoFeatureExtractor.from_pretrained(model_name)
|
70 |
|
|
|
77 |
image = get_original_image(url_input)
|
78 |
elif image_input is not None:
|
79 |
image = image_input
|
|
|
|
|
80 |
|
81 |
# Make prediction
|
82 |
processed_outputs = make_prediction(image, feature_extractor, model)
|
|
|
101 |
urls = ["https://drive.google.com/uc?id=1j9VZQ4NDS4gsubFf3m2qQoTMWLk552bQ", "https://drive.google.com/uc?id=1p9wJIqRz3W50e2f_A0D8ftla8hoXz4T5"]
|
102 |
images = [[path.as_posix()] for path in sorted(pathlib.Path('images').rglob('*.j*g'))]
|
103 |
|
|
|
|
|
|
|
104 |
|
105 |
css = '''
|
106 |
h1#title {
|
|
|
145 |
url_but.click(fn=detect_objects, inputs=[options, url_input, img_input, slider_input], outputs=[img_output_from_url], queue=True)
|
146 |
img_but.click(fn=detect_objects, inputs=[options, url_input, img_input, slider_input], outputs=[img_output_from_upload], queue=True)
|
147 |
|
148 |
+
#gr.Markdown("")
|
149 |
|
150 |
demo.launch(debug=True)
|