简单的问答系统

本文介绍了一个简单的问答系统,使用Python和Django框架开发,结合TensorFlow进行模型训练。虽然界面朴素,但能实现基本的问答功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

效果如下:

界面比较简陋,界面的大致代码如下:

{%extends "base.html" %}
{% block body_block %}
   <a href="/category/index" onClick="javascript :history.back(-1);" style="margin-left: 50px;">返回</a>
   <h3 style="margin-left: 50px;">当前用户: {
  
  { user }}&nbsp;&nbsp;</h3>
   <div class="row">
      <div id="chatting" style="width: 500px;height: 500px;border: 1px solid #000000;float: left;overflow: auto;margin-left: 30px;" ></div>
   </div>

         <div class="col-lg-4">
                <div class="input-group">
                    <input id="msg" type="text" class="form-control">
                    <span class="input-group-btn">
                        <button id="sendmsg" class="btn btn-default" type="button">Go!</button>
                    </span>
                </div><!-- /input-group -->
            </div><!-- /.col-lg-6 -->
{% endblock %}
{% block js %}
   <script>
      // using jQuery
      function getCookie(name) {
         var cookieValue = null;
         if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
               var cookie = jQuery.trim(cookies[i]);
               // Does this cookie string begin with the name we want?
               if (cookie.substring(0, name.length + 1) == (name + '=')) {
                  cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                  break;
               }
            }
         }
         return cookieValue;
      }
      var csrftoken = getCookie('csrftoken');
      function csrfSafeMethod(method) {
         // these HTTP methods do not require CSRF protection
         return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
      }
      $.ajaxSetup({
         beforeSend: function(xhr, settings) {
            if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
               xhr.setRequestHeader("X-CSRFToken", csrftoken);
            }
         }
      });
      // 时间格式
      Date.prototype.Format = function (fmt) { //author: meizz
         var o = {
            "M+": this.getMonth() + 1, //月份
            "d+": this.getDate(), //日
            "h+": this.getHours(), //小时
            "m+": this.getMinutes(), //分
            "s+": this
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值