Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -661,7 +661,7 @@ def process_image(focal_image, same_brand_files, competitive_brand_files):
|
|
| 661 |
avg_r = visual_features['Average Red']
|
| 662 |
avg_g = visual_features['Average Green']
|
| 663 |
avg_b = visual_features['Average Blue']
|
| 664 |
-
visual_complexity = visual_features['Visual Complexity
|
| 665 |
|
| 666 |
# Perform object detection
|
| 667 |
object_detection_results = perform_object_detection(focal_image)
|
|
@@ -736,14 +736,6 @@ def process_image(focal_image, same_brand_files, competitive_brand_files):
|
|
| 736 |
emo_neutral
|
| 737 |
]
|
| 738 |
|
| 739 |
-
import cv2, requests
|
| 740 |
-
image = cv2.imdecode(np.frombuffer(requests.get("https://github.com/JaidedAI/EasyOCR/raw/master/examples/english.png").content, np.uint8), cv2.IMREAD_COLOR)
|
| 741 |
-
|
| 742 |
-
image = Image.fromarray(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
|
| 743 |
-
image = image.convert('RGB')
|
| 744 |
-
image
|
| 745 |
-
|
| 746 |
-
process_image(image, None, None)
|
| 747 |
|
| 748 |
"""#5. Gradio Interface"""
|
| 749 |
|
|
@@ -836,7 +828,7 @@ with gr.Blocks() as demo:
|
|
| 836 |
avg_r_output = gr.Textbox(label='Average Red')
|
| 837 |
avg_g_output = gr.Textbox(label='Average Green')
|
| 838 |
avg_b_output = gr.Textbox(label='Average Blue')
|
| 839 |
-
visual_complexity_output = gr.Textbox(label='Visual Complexity')
|
| 840 |
gr.Markdown("## Object Detection")
|
| 841 |
with gr.Row():
|
| 842 |
car_count_output = gr.Textbox(label='Car Count')
|
|
|
|
| 661 |
avg_r = visual_features['Average Red']
|
| 662 |
avg_g = visual_features['Average Green']
|
| 663 |
avg_b = visual_features['Average Blue']
|
| 664 |
+
visual_complexity = visual_features['Visual Complexity']
|
| 665 |
|
| 666 |
# Perform object detection
|
| 667 |
object_detection_results = perform_object_detection(focal_image)
|
|
|
|
| 736 |
emo_neutral
|
| 737 |
]
|
| 738 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 739 |
|
| 740 |
"""#5. Gradio Interface"""
|
| 741 |
|
|
|
|
| 828 |
avg_r_output = gr.Textbox(label='Average Red')
|
| 829 |
avg_g_output = gr.Textbox(label='Average Green')
|
| 830 |
avg_b_output = gr.Textbox(label='Average Blue')
|
| 831 |
+
visual_complexity_output = gr.Textbox(label='Visual Complexity (0 to 1)')
|
| 832 |
gr.Markdown("## Object Detection")
|
| 833 |
with gr.Row():
|
| 834 |
car_count_output = gr.Textbox(label='Car Count')
|