views.py 文件源码

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

项目:HSISeg 作者: HSISeg 项目源码 文件源码
def get_beta(request):
    if request.method == 'POST':
        try:
            params = json.loads(request.body)
        except:
            return HttpResponseBadRequest(json.dumps({'error':'Json required'}),content_type="application/json")
        if not params.get("output_path") or not params.get("image_pickle_file_path"): 
            return HttpResponseBadRequest(json.dumps({'error':'output_path and image_pickle_file_path manadatory'}),content_type="application/json")
        pid_element = Results.objects.create(pid=None)
        params['id'] = pid_element.id
        params = json.dumps(params)
        command = "python make_beta.py '"+str(params)+"' &"
        proc = subprocess.Popen(command,shell=True)
        return HttpResponse(json.dumps({'success':True,'task_id':pid_element.id}),content_type="application/json")
    else:
        raise Http404()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号