#!/usr/local/bin/python3.7
#! _*_ coding:utf-8 _*_
from flask import Flask, request, render_template, send_file,jsonify
import requests
import json
app = Flask(__name__)
@app.route('/')
def welcome():
return send_file('templates/index.html')
@app.route('/second/details', methods=['post','get'])
def details(name=None):
username = request.args.get('name')
fin_result = []
url = "http://localhost:8983/solr/search/select?q=contents:"+username
r = requests.get(url)
response = json.loads(r.text)
result = response['response']['docs']
json_dirc = {}
index = 1
#fin_result = []
for i in result:
del i['id']
del i['_version_']
for key, value in i.items():
temp = "".join(value)
i[key] = temp
fin_result.append(i)
#json_list.append(json.dumps(i,ensure_ascii=False))
json_dirc[index]=i
index = index + 1
json_result = json.dumps(json_dirc,ensure_ascii=False)
#return json_result
#return jsonify(json_dirc)
if username==None:
print("is None")
else:
print(username)
for i in fin_result:
if i['name'] == username:
temp = i
return render_template('third.html', title = username ,dict = temp)
@app.route('/second/', methods=['post','get'])
def second_html():
username = request.form.get('search_contents')
fin_result = []
url = "http://localhost:8983/solr/search/select?q=contents:"+username
r = requests.get(url)
response = json.loads(r.text)
result = response['response']['docs']
json_dirc = {}
index = 1
#fin_result = []
for i in result:
del i['id']
del i['_version_']
for key, value in i.items():
temp = "".join(value)
i[key] = temp
fin_result.append(i)
#json_list.append(json.dumps(i,ensure_ascii=False))
json_dirc[index]=i
index = index + 1
json_result = json.dumps(json_dirc,ensure_ascii=False)
#return json_result
#return jsonify(json_dirc)
return render_template('second.html', List = fin_result)
if __name__ == '__main__':
# app.run(host = '0.0.0.0',port = 5000)
app.run(debug = True)
没有合适的资源?快使用搜索试试~ 我知道了~
人工智能-项目实践-搜索引擎-中文医学搜索引擎-demo
共23个文件
css:4个
js:4个
html:3个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 42 浏览量
2024-02-26
18:12:29
上传
评论
收藏 7.91MB ZIP 举报
温馨提示
中文医学搜索引擎_demo
资源推荐
资源详情
资源评论
收起资源包目录
flask_demo-master.zip (23个子文件)
flask_demo-master
docker
Docker.md 470B
templates
third.html 1KB
index.html 3KB
second.html 440B
server.py 2KB
img
second.png 791KB
index.png 3.76MB
details.png 476KB
data.csv 7.62MB
static
.DS_Store 8KB
js
ios-parallax.js 3KB
jquery.mousewheel.min.js 3KB
index.js 2KB
jquery.min.js 91KB
style
style.css 1KB
global.css 1KB
css
style.css 522B
bootstrap.css 138KB
images
mountains_light_sun_sky_clouds_114136_2560x1080.jpg 94KB
fonts
glyphicons-halflings-regular.ttf 44KB
glyphicons-halflings-regular.woff 23KB
glyphicons-halflings-regular.eot 20KB
glyphicons-halflings-regular.woff2 18KB
共 23 条
- 1
资源评论
博士僧小星
- 粉丝: 1931
- 资源: 5896
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功