【问题标题】:Keras model deploy to flask text prediction, but not predicting help meKeras 模型部署到烧瓶文本预测,但没有预测帮助我
【发布时间】:2020-05-09 16:46:46
【问题描述】:

@app.route('/article//') 定义文章(id): # 创建游标 mycursor = mydb.cursor(dictionary=True)

# Get article
result = mycursor.execute("SELECT label FROM articles WHERE id = %s", [id])

article = mycursor.fetchone()

features = prepData(article)

prediction = int((np.asscalar(load_model.predict(features)))*100)
return render_template('article.html', article=article, prediction=prediction)

【问题讨论】:

    标签: flask keras model predict


    【解决方案1】:

    {% 扩展'layout.html' %}

    {% 块体 %}

    <h1>{{article.title}}</h1>
    <small>Written by {{article.author}} on {{article.create_date}}</small>
    <hr>
    <div>
        {{article.body }}
    </div>
    
    
    <h1>Predicted:</h1>
    {{ prediction }}
    

    {% 端块 %}

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-02-10
      • 2020-03-13
      • 1970-01-01
      • 2018-01-30
      • 2019-05-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多