|
|
|
@ -33,6 +33,8 @@ def upload(request):
|
|
|
|
def dlurl(request):
|
|
|
|
def dlurl(request):
|
|
|
|
if request.method == 'GET':
|
|
|
|
if request.method == 'GET':
|
|
|
|
url = request.GET["url"] #获取前端上传的文件
|
|
|
|
url = request.GET["url"] #获取前端上传的文件
|
|
|
|
|
|
|
|
m_model=request.GET["model"]
|
|
|
|
|
|
|
|
print(m_model)
|
|
|
|
print(url)
|
|
|
|
print(url)
|
|
|
|
name = url.split(r'/')[-1]
|
|
|
|
name = url.split(r'/')[-1]
|
|
|
|
if not (name.endswith(".jpg") or name.endswith(".jpeg") or name.endswith(".png") or name.endswith(".bmp")):
|
|
|
|
if not (name.endswith(".jpg") or name.endswith(".jpeg") or name.endswith(".png") or name.endswith(".bmp")):
|
|
|
|
@ -48,8 +50,14 @@ def dlurl(request):
|
|
|
|
f.close
|
|
|
|
f.close
|
|
|
|
#返回给前端的图片路径用相对路径,前端用绝对路径反而加载不了图片
|
|
|
|
#返回给前端的图片路径用相对路径,前端用绝对路径反而加载不了图片
|
|
|
|
img_path_res = '/static/detected/'+fix+name
|
|
|
|
img_path_res = '/static/detected/'+fix+name
|
|
|
|
RR = DL.run(weights=(curPath+"/yolov5/v6m6.pt"), source=img_path, project=(curPath+"/static/detected"))
|
|
|
|
if(int(m_model)==1): #小模型
|
|
|
|
return JsonResponse({'img_name':img_path_res,'code':RR, 'flag': True})
|
|
|
|
RR = DL.run(weights=(curPath+"/yolov5/v3s.pt"), source=img_path, project=(curPath+"/static/detected"))
|
|
|
|
|
|
|
|
return JsonResponse({'img_name':img_path_res,'code':"【小模型】"+RR, 'flag': True})
|
|
|
|
|
|
|
|
if(int(m_model)==2): #大模型
|
|
|
|
|
|
|
|
RR = DL.run(weights=(curPath+"/yolov5/v6m6.pt"), source=img_path, imgsz=(1280, 1280), project=(curPath+"/static/detected"))
|
|
|
|
|
|
|
|
return JsonResponse({'img_name':img_path_res,'code':"【大模型】"+RR, 'flag': True})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def home(request):
|
|
|
|
def home(request):
|
|
|
|
return render(request, 'home.html')
|
|
|
|
return render(request, 'home.html')
|