Spaces:
Sleeping
Sleeping
Delete app.py
Browse files
app.py
DELETED
@@ -1,30 +0,0 @@
|
|
1 |
-
import cv2
|
2 |
-
import numpy as np
|
3 |
-
import gradio as gr
|
4 |
-
from PIL import Image
|
5 |
-
from TheDistanceAssessor import run, load_segformer, load_yolo
|
6 |
-
|
7 |
-
def process_image(input_image):
|
8 |
-
image_size = [1024,1024]
|
9 |
-
target_distances = [650,1000,2000]
|
10 |
-
num_ys = 10
|
11 |
-
|
12 |
-
PATH_model_seg = 'SegFormer_B3_1024_finetuned.pth'
|
13 |
-
PATH_model_det = 'yolov8s.pt'
|
14 |
-
model_seg = load_segformer(PATH_model_seg)
|
15 |
-
model_det = load_yolo(PATH_model_det)
|
16 |
-
output_image = run(input_image, model_seg, model_det, image_size, target_distances, num_ys = num_ys)
|
17 |
-
return output_image
|
18 |
-
|
19 |
-
# Create the Gradio interface
|
20 |
-
iface = gr.Interface(
|
21 |
-
fn=process_image, # The function to be called
|
22 |
-
inputs=gr.Image(type="pil"), # Input type
|
23 |
-
outputs=gr.Image(type="numpy"), # Output type
|
24 |
-
title="Image Processor", # Title of the interface
|
25 |
-
description="Upload an image and get a processed image as output." # Description of the interface
|
26 |
-
)
|
27 |
-
|
28 |
-
# Launch the interface
|
29 |
-
if __name__ == "__main__":
|
30 |
-
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|