首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >returndata:没有名为“返回数据”的模块

returndata:没有名为“返回数据”的模块
EN

Stack Overflow用户
提问于 2019-10-04 19:56:50
回答 1查看 301关注 0票数 0

我在Python中创建了一个模型,用于根据图像预测结果,运行它时会得到以下错误:

以下错误:

代码语言:javascript
复制
(base) MacBook-Air:Backend desktop$ python main.py
Traceback (most recent call last):
  File "main.py", line 3, in <module>
    from returndata import Content
ModuleNotFoundError: No module named 'returndata'

,我找不到任何相关的东西。,这是我的模型的代码:app.py:

代码语言:javascript
复制
import os
from flask import *
from returndata import Content
import predict as pred
from werkzeug.utils import secure_filename

UPLOAD_FOLDER = './static/UPLOADFOLDER'

ALLOWED_EXTENSIONS = set(['png', 'jpg', 'jpeg', 'bmp'])



TOPIC_DICT = Content()
app = Flask(__name__)
app._static_folder = "static"
@app.route('/')
def homepage():
    return render_template("index.html")


@app.route('/skin/')
def skin():
    return render_template("skinLesion.html")

@app.route('/retinopathy/')
def retinopathy():
    return render_template("retinopathy.html")


@app.route('/upload/', methods=["POST"])
def upload():
    app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
    if request.method == 'POST':
        # check if the post request has the file part
        if 'file' not in request.files:
            print(request.files)
            d = Response("Error",status=201,mimetype='application/json')
            return d
        file = request.files['file']
        # if user does not select file, browser also
        # submit a empty part without filename
        if file.filename == '':
            d = Response("No filename",status=201,mimetype='application/json')
            return d
        if file:
            filename = secure_filename(file.filename)
            file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
            return pred.classify(filename, response=True)

@app.route('/uploadPC/', methods=["POST"])
def uploadPC():
    print("in upload")
    app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
    if request.method == 'POST':
        # check if the post request has the file part
        if 'file' not in request.files:
            print(request.files)
            d = Response("Error",status=201,mimetype='application/json')
            return d
        file = request.files['file']
        # if user does not select file, browser also
        # submit a empty part without filename
        if file.filename == '':
            d = Response("No filename",status=201,mimetype='application/json')
            return d
        if file:
            filename = secure_filename(file.filename)
            file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
            category, confidence = pred.classify(filename, response=False)
            print(category, confidence)
            confidence = '%.2f'%(confidence*100)
            if category == "malignant":
                return render_template("malignant.html", confidence=confidence)
            else:
                return render_template("benign.html", confidence=confidence)




@app.route('/uploadDiabetic/', methods=["POST"])
def uploadDiabetic():

    app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
    if request.method == 'POST':
        # check if the post request has the file part
        if 'file' not in request.files:
            print(request.files)
            d = Response("Error",status=201,mimetype='application/json')
            return d
        file = request.files['file']
        # if user does not select file, browser also
        # submit a empty part without filename
        if file.filename == '':
            d = Response("No filename",status=201,mimetype='application/json')
            return d
        if file:
            filename = secure_filename(file.filename)
            file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
            return pred.classify_retino(filename, response=True)

我不知道如何解决这个问题。有人能帮我吗?在此之前,非常感谢您。

我该给你换什么?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-10-04 20:08:12

您实际使用的是"returndata“和"TOPIC_DICT = Content()”吗?

Python不能导入这个模块。要么安装它,要么给出正确的路径,从哪里导入模块。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58242524

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档