view_index.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:FastRCNN-TF-Django 作者: DamonLiuNJU 项目源码 文件源码
def saveImage(image):
    pwd = os.getcwd()
    filetype = image.content_type.split('/')[1]
    filePath = os.path.abspath(os.path.dirname(pwd)) + '/Django/image/' + str(time.time()) + '.' + filetype

    if isinstance(image, TemporaryUploadedFile):
        temp_file = open(image.temporary_file_path(), 'rb+')
        content = cStringIO.StringIO(temp_file.read())
        image = Image.open(content)
        temp_file.close()

    # image.seek(0)
    # img = Image.open(image)
    # img.save(filePath)
    default_storage.save(filePath, ContentFile(image.read()))
    path = detectObject(filePath, filetype)
    # new_img = Image.open(path)
    fileName = path.split('/')[-1]
    return fileName
    # return HttpResponse("<img src="{% static img %}" style="width: 80%;alignment: center">")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号