Update app.py
Browse files
app.py
CHANGED
@@ -4,15 +4,16 @@ import os
|
|
4 |
|
5 |
# 获取third_party文件夹的绝对路径
|
6 |
#third_party_path = os.path.abspath('./third_party/')
|
|
|
7 |
os.environ['LD_LIBRARY_PATH'] = f"{os.environ.get('LD_LIBRARY_PATH', '')}:/usr/lib/x86_64-linux-gnu/"
|
8 |
-
os.system("chmod a+x
|
9 |
-
os.system("find / -type f -name libopencv_imgcodecs*")
|
10 |
-
print(os.environ.get('LD_LIBRARY_PATH'))
|
11 |
-
os.system("
|
12 |
-
os.system("ldd ./yolov5s-tt100k-static.bin")
|
13 |
def run_yolov5s(image_filepath):
|
14 |
os.system("./yolov5s-tt100k-static.bin --help")
|
15 |
-
result = subprocess.run([
|
16 |
return "yolov5s-tt100k.out.jpg", result.stdout
|
17 |
|
18 |
iface = gr.Interface(fn=run_yolov5s, inputs=gr.Image(type="filepath"), outputs=[gr.Image(type="filepath"), gr.Textbox()])
|
|
|
4 |
|
5 |
# 获取third_party文件夹的绝对路径
|
6 |
#third_party_path = os.path.abspath('./third_party/')
|
7 |
+
BIN = "./yolov5s-tt100k-debian12.bin"
|
8 |
os.environ['LD_LIBRARY_PATH'] = f"{os.environ.get('LD_LIBRARY_PATH', '')}:/usr/lib/x86_64-linux-gnu/"
|
9 |
+
os.system(f"chmod a+x {BIN}")
|
10 |
+
# os.system("find / -type f -name libopencv_imgcodecs*")
|
11 |
+
# print(os.environ.get('LD_LIBRARY_PATH'))
|
12 |
+
os.system(f"{BIN} --help")
|
13 |
+
# os.system("ldd ./yolov5s-tt100k-static.bin")
|
14 |
def run_yolov5s(image_filepath):
|
15 |
os.system("./yolov5s-tt100k-static.bin --help")
|
16 |
+
result = subprocess.run([BIN, "-m", "./yolov5s_tt100k_opt_fp32.tmfile", "-i", image_filepath], capture_output=True, text=True, shell=True, env=os.environ)
|
17 |
return "yolov5s-tt100k.out.jpg", result.stdout
|
18 |
|
19 |
iface = gr.Interface(fn=run_yolov5s, inputs=gr.Image(type="filepath"), outputs=[gr.Image(type="filepath"), gr.Textbox()])
|