|
|
|
@ -80,20 +80,6 @@ def recognition(url):
|
|
|
|
|
# print(error.code)
|
|
|
|
|
# return JsonResponse({'error': str(error)}, status=500)
|
|
|
|
|
|
|
|
|
|
# def upload(path):
|
|
|
|
|
# headers = {
|
|
|
|
|
# 'Authorization': 'Bearer 16|Nf1vBh8F0tIy6tAU1Dnbx6C4C2xzn6aSUHA7la6h',
|
|
|
|
|
# }
|
|
|
|
|
# files = {'file': open(path, 'rb')}
|
|
|
|
|
# url = 'https://picui.cn/api/v1/upload'
|
|
|
|
|
# response = requests.post(url, files=files, headers=headers)
|
|
|
|
|
# response_data = response.json()
|
|
|
|
|
# tmp=str(response_data['data']['links']['url'])
|
|
|
|
|
# # print(tmp)
|
|
|
|
|
# return tmp
|
|
|
|
|
# # print(json.dumps(response_data, indent=4))
|
|
|
|
|
# # print(U)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#垃圾识别接口
|
|
|
|
|
app = Flask(__name__)
|
|
|
|
@ -114,7 +100,7 @@ def upload_image():
|
|
|
|
|
if file:
|
|
|
|
|
# 保存上传的文件到指定目录
|
|
|
|
|
file.save(os.path.join(app.config['UPLOAD_FOLDER'], 'garbage.jpg'))
|
|
|
|
|
a = recognition(upload(os.path.join(app.config['UPLOAD_FOLDER'], 'garbage.jpg')))
|
|
|
|
|
a = recognition(os.path.join(app.config['UPLOAD_FOLDER'], 'garbage.jpg'))
|
|
|
|
|
print(a)
|
|
|
|
|
return a
|
|
|
|
|
|
|
|
|
|