【发布时间】:2021-06-12 16:30:23
【问题描述】:
我正在使用 flask 和 ml 进行图书推荐,因此我已将图书的图片链接收集到一个列表中,但无法弄清楚如何在模板中显示这些图片列表。
这是我将参数传递给模板的代码
@app.route('/search',methods=['GET','POST'])
def search():
choice = request.args.get('search')
# removing all the characters except alphabets and numbers.
# passing the choice to the recommend() function
# passing the choice to the recommend() function
books = recommend(choice)
image=get_image(books)
# if rocommendation is a string and not list then it is else part of the
# recommend() function.
if type(books) == type('string'):
return render_template('read.html', book=books,image=image,s='opps')
else:
return render_template('read.html', book=books,image=image)
但无论如何我都不会在我的主模板中显示这些图像列表。 你能帮我解决这个问题吗..
提前致谢
【问题讨论】:
标签: python flask flask-login