Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -56,6 +56,7 @@ def detect_objects_in_image(image):
|
|
56 |
if isinstance(image, np.ndarray):
|
57 |
print("Converting NumPy array to PIL Image")
|
58 |
image = Image.fromarray(image)
|
|
|
59 |
orig_w, orig_h = image.size
|
60 |
|
61 |
|
@@ -106,9 +107,9 @@ def detect_objects_in_image(image):
|
|
106 |
(0, 255, 0), 2)
|
107 |
|
108 |
# Generate and return graph instead of dictionary
|
109 |
-
graph_image = generate_vehicle_count_graph(object_counts)
|
110 |
-
|
111 |
-
return Image.fromarray(img_array)
|
112 |
|
113 |
|
114 |
# def generate_vehicle_count_graph(object_counts):
|
@@ -179,6 +180,8 @@ def detect_objects_in_video(video_input):
|
|
179 |
if not ret:
|
180 |
break
|
181 |
|
|
|
|
|
182 |
image = Image.fromarray(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB))
|
183 |
|
184 |
# Get frame with detected objects and graph
|
@@ -193,8 +196,6 @@ def detect_objects_in_video(video_input):
|
|
193 |
return temp_video_output, graph_image # Return both expected outputs
|
194 |
|
195 |
|
196 |
-
def greet(name):
|
197 |
-
return "Hello " + name + "!!"
|
198 |
|
199 |
|
200 |
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
|
|
56 |
if isinstance(image, np.ndarray):
|
57 |
print("Converting NumPy array to PIL Image")
|
58 |
image = Image.fromarray(image)
|
59 |
+
print(image.size)
|
60 |
orig_w, orig_h = image.size
|
61 |
|
62 |
|
|
|
107 |
(0, 255, 0), 2)
|
108 |
|
109 |
# Generate and return graph instead of dictionary
|
110 |
+
# graph_image = generate_vehicle_count_graph(object_counts)
|
111 |
+
|
112 |
+
return Image.fromarray(img_array)#, graph_image # Now returning only 2 outputs
|
113 |
|
114 |
|
115 |
# def generate_vehicle_count_graph(object_counts):
|
|
|
180 |
if not ret:
|
181 |
break
|
182 |
|
183 |
+
|
184 |
+
|
185 |
image = Image.fromarray(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB))
|
186 |
|
187 |
# Get frame with detected objects and graph
|
|
|
196 |
return temp_video_output, graph_image # Return both expected outputs
|
197 |
|
198 |
|
|
|
|
|
199 |
|
200 |
|
201 |
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|