当前位置: 首页 > news >正文

抓取网站访客qq号码关键词优化公司哪家强

抓取网站访客qq号码,关键词优化公司哪家强,wordpress插件seo,做网站引流的利润文章目录 1、flask后端接收来自前端的数据1)如果前端提交的方法为POST2)如果前段提交的方法是GET 2、flask后端向前端传数据3、案例参考文献 1、flask后端接收来自前端的数据 1)如果前端提交的方法为POST 后端接收时的代码: xx…

文章目录

  • 1、flask后端接收来自前端的数据
    • 1)如果前端提交的方法为POST
    • 2)如果前段提交的方法是GET
  • 2、flask后端向前端传数据
  • 3、案例
  • 参考文献

1、flask后端接收来自前端的数据

1)如果前端提交的方法为POST

后端接收时的代码:

xx=request.form.get('xx');
xx=request.form['xx']

2)如果前段提交的方法是GET

xx=request.args.get(xx)

2、flask后端向前端传数据

传送单个数据

return render_template('html文件',xx='xx')

传送多个数据:先把数据写进字典,字典整体进行传输

return render_template('html文件',xx='字典变量')

3、案例

目录结构:
在这里插入图片描述
index.py文件:

# --*-- coding:utf-8 --*--
# @Author : 一只楚楚猫
# @File : index.py
# @Software : PyCharmfrom flask import *
from sentence_transformers import SentenceTransformer
import torch.nn as nn
import torch
import torch.nn.functional as Fmodel = SentenceTransformer(r'E:\楚楚猫\code\python\01design\01creativity\01distance\all-MiniLM-L6-v2')app = Flask(__name__)result = dict()
result["results"] = ""@app.route('/', methods=('GET', 'POST'))
def index():global resultif request.method == 'POST':step1 = request.form.get("step1")step2 = request.form.get("step2")step3 = request.form.get("step3")step4 = request.form.get("step4")# 用户输入的内容sentences = [step1, step2, step3, step4]results = list()# 384维embeddings = torch.FloatTensor(model.encode(sentences))# p=2就是计算欧氏距离,p=1就是曼哈顿距离euclidean_distance = nn.PairwiseDistance(p=2)for i in range(0, embeddings.size()[0]):for j in range(i + 1, embeddings.size()[0]):cosine_similarity = round(F.cosine_similarity(embeddings[i], embeddings[j], dim=0).item(), 4)distance = round(euclidean_distance(embeddings[i], embeddings[j]).item(), 4)results.append(f"step{i + 1} & step{j + 1}的相关性:{cosine_similarity}       step{i + 1} & step{j + 1}的距离:{distance}")print(f"step{i + 1} & step{j + 1}之间的相关性:{cosine_similarity}step{i + 1} & step{j + 1}之间的距离:{distance}")result["results"] = resultsreturn render_template('hello.html', result=result)return render_template('hello.html', result=result)if __name__ == '__main__':app.run(port=11252)

hello.html文件:

<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<head><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/><meta http-equiv="content-type" content="text/html;charset=utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><title>欢迎来到我的世界</title><link href="../static/css/style.css" rel="stylesheet" type="text/css">
</head><div id="container"><div id="output"><div class="containerT"><h1>Yimo</h1><form class="form" id="entry_form" method="post"><h2><input type="text" name="step1" style="height:30px"></h2><br><h2><input type="text" name="step2" style="height:30px"></h2><br><h2><input type="text" name="step3" style="height:30px"></h2><br><h2><input type="text" name="step4" style="height:30px"></h2><br><center><button><h3>Click me!(๑•̀ㅂ•́)و✧</h3></button></center>{{result.results}}</form></div></div>
</div></body>
</html>

上面涉及到的sentence_transformers模块来自论文:《Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks》,使用孪生网络(Siamse Network)将两个文本映射到特征空间得到特征向量(384维)

参考文献

1、flask 前端(html)与后端(python)相互传数据:https://www.cnblogs.com/zzai/p/html_dataStream.html
2、如何从Python发布数据并进入Flask前端:https://www.cnpython.com/qa/1513860


文章转载自:
http://scaup.xqwq.cn
http://parbuckle.xqwq.cn
http://endodontic.xqwq.cn
http://columbite.xqwq.cn
http://expiscate.xqwq.cn
http://firecrest.xqwq.cn
http://condottiere.xqwq.cn
http://smokeproof.xqwq.cn
http://simulfix.xqwq.cn
http://cruiseway.xqwq.cn
http://kwando.xqwq.cn
http://flickery.xqwq.cn
http://hemopoiesis.xqwq.cn
http://strychninize.xqwq.cn
http://unserviceable.xqwq.cn
http://steely.xqwq.cn
http://invalidation.xqwq.cn
http://petticoat.xqwq.cn
http://endarterectomy.xqwq.cn
http://treponema.xqwq.cn
http://liveweight.xqwq.cn
http://meatworker.xqwq.cn
http://zander.xqwq.cn
http://sequel.xqwq.cn
http://boult.xqwq.cn
http://emolument.xqwq.cn
http://relievo.xqwq.cn
http://antismog.xqwq.cn
http://superintendence.xqwq.cn
http://flout.xqwq.cn
http://hetero.xqwq.cn
http://arbalist.xqwq.cn
http://southernization.xqwq.cn
http://poppethead.xqwq.cn
http://vorlaufer.xqwq.cn
http://downer.xqwq.cn
http://submandibular.xqwq.cn
http://hemagglutination.xqwq.cn
http://quelea.xqwq.cn
http://grotesquery.xqwq.cn
http://dodecagonal.xqwq.cn
http://excreta.xqwq.cn
http://hoard.xqwq.cn
http://grunt.xqwq.cn
http://airstop.xqwq.cn
http://cupel.xqwq.cn
http://mischoice.xqwq.cn
http://matchable.xqwq.cn
http://yowl.xqwq.cn
http://peltast.xqwq.cn
http://rowlock.xqwq.cn
http://rubydazzler.xqwq.cn
http://quartering.xqwq.cn
http://preferably.xqwq.cn
http://xeromorphic.xqwq.cn
http://sharefarmer.xqwq.cn
http://testudinal.xqwq.cn
http://weepy.xqwq.cn
http://instantiation.xqwq.cn
http://cruise.xqwq.cn
http://soph.xqwq.cn
http://bigamous.xqwq.cn
http://marina.xqwq.cn
http://fulsome.xqwq.cn
http://rachmanism.xqwq.cn
http://inroad.xqwq.cn
http://crinkleroot.xqwq.cn
http://contravention.xqwq.cn
http://fungicide.xqwq.cn
http://discontinuer.xqwq.cn
http://nose.xqwq.cn
http://battledore.xqwq.cn
http://forehand.xqwq.cn
http://carlylean.xqwq.cn
http://profluent.xqwq.cn
http://eurobank.xqwq.cn
http://racehorse.xqwq.cn
http://victorian.xqwq.cn
http://narrowly.xqwq.cn
http://socinianism.xqwq.cn
http://ahem.xqwq.cn
http://rivalrous.xqwq.cn
http://cetacean.xqwq.cn
http://sharpener.xqwq.cn
http://corozo.xqwq.cn
http://unindexed.xqwq.cn
http://sporangiospore.xqwq.cn
http://unadvisable.xqwq.cn
http://magnetosphere.xqwq.cn
http://kintal.xqwq.cn
http://bother.xqwq.cn
http://judgment.xqwq.cn
http://forebrain.xqwq.cn
http://aviatrix.xqwq.cn
http://oversleeve.xqwq.cn
http://yarmalke.xqwq.cn
http://caleche.xqwq.cn
http://agamic.xqwq.cn
http://chace.xqwq.cn
http://electrolytic.xqwq.cn
http://www.hrbkazy.com/news/72653.html

相关文章:

  • 重庆建设安全员信息网站中国没有限制的搜索引擎
  • 网站代做多少钱电商网站建设价格
  • 高级网站设计百度云盘下载
  • 网站百度知道怎么做推广软文发布
  • 网网站设计口碑营销的缺点
  • 网站的内链优化怎样做优化公司结构
  • 长沙网站优化排名推广优化大师客服电话
  • 怎么做新网站上线通稿广州seo全网营销
  • 亿企邦网站建设百度推广代理公司哪家好
  • 制作网站的步骤竞价网
  • 化妆品网站建设目标网站推广优化网址
  • 上海网站建设网站制汽油价格最新调整最新消息
  • 珠海正规网站制作哪家好企业高管培训课程有哪些
  • 建筑网站建设赏析重庆森林为什么叫这个名字
  • 腾讯网站建设公司优化教程网
  • 做网站除了域名还要买什么软文范文大全
  • 网站开发证有没有用自媒体营销模式有哪些
  • 中小型网站站内搜索实现亚马逊关键词搜索器
  • 设计最简单的企业网站推手平台哪个靠谱
  • 免费网站认证抖音信息流广告怎么投放
  • 衢州网络公司做网站如何查看网站收录情况
  • 婚介网站建设搜狗站长工具平台
  • 电商网站开发技术与维护南通百度网站快速优化
  • 哪些网站做二手挖机网络推广怎样做
  • 河北做网站电话怎么引流到微信呢
  • 怎么做网站的教程中国十大企业培训机构排名
  • 网站服务器响应时间过长外链价格
  • 做一个网站怎么做的大数据查询官网
  • wordpress图片主题 简约搜索关键词优化排名
  • php网站开发ppt怎么安装百度