基于Flask的机器学习模型嵌入Web应用全解析
1. 搭建目录结构
首先,我们要为应用程序搭建新的目录结构,具体如下:
1st_flask_app_2/
app.py
static/
style.css
templates/
_formhelpers.html
first_app.html
hello.html
以下是修改后的 app.py 文件内容:
from flask import Flask, render_template, request
from wtforms import Form, TextAreaField, validators
app = Flask(__name__)
class HelloForm(Form):
sayhello = TextAreaField('',[validators.DataRequired()])
@app.route('/')
def index():
form = HelloForm(request.form)
return render_template('first_app.html', form=form)
@app.route('/hello', methods=['POST'])
def hello():
form = HelloForm(request.form)
if reque
超级会员免费看
订阅专栏 解锁全文
1907

被折叠的 条评论
为什么被折叠?



