zhaoyingjun / chatbot

ChatGPT带火了聊天机器人,主流的趋势都调整到了GPT类模式,本项目也与时俱进,会在近期更新GPT类版本。基于本项目和自己的语料可以训练出自己想要的聊天机器人,用于智能客服、在线问答、闲聊等场景。
3.53k stars 1.02k forks source link

app.py无法正常使用 #134

Open 60753b9e opened 2 years ago

60753b9e commented 2 years ago
 * Serving Flask app "app" (lazy loading)                                                           [39/1867]
 * Environment: production                                                                                   
   WARNING: Do not use the development server in a production environment.         
   Use a production WSGI server instead.                                                                     
 * Debug mode: off                                    
 * Running on all addresses.                                                                                 
   WARNING: This is a development server. Do not use it in a production deployment.                          
 * Running on http://**************:8809/ (Press CTRL+C to quit)                                            
Building prefix dict from the default dictionary ...                                                         
Loading model from cache /tmp/jieba.cache                                                                    
Loading model cost 0.942 seconds.                                                                            
Prefix dict has been built successfully.                                                                     
[2022-06-23 22:31:06,778] ERROR in app: Exception on /message [POST]
Traceback (most recent call last):
  File "/home/ella/anaconda3/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/ella/anaconda3/lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/ella/anaconda3/lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/ella/anaconda3/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/home/ella/anaconda3/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/ella/anaconda3/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "web/app.py", line 43, in reply
    res_msg = execute.predict(req_msg)
AttributeError: module 'execute' has no attribute 'predict'                                               
127.0.0.1 - - [23/Jun/2022 22:31:06] "POST /message HTTP/1.1" 500 -                                          
127.0.0.1 - - [23/Jun/2022 22:31:50] "GET /static/js/jquery.min.map HTTP/1.1" 404 -                          
[2022-06-23 22:31:51,075] ERROR in app: Exception on /message [POST]                                         
Traceback (most recent call last):                                                                           
  File "/home/ella/anaconda3/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app               
    response = self.full_dispatch_request()                                                                  
  File "/home/ella/anaconda3/lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/ella/anaconda3/lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/ella/anaconda3/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/home/ella/anaconda3/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/ella/anaconda3/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "web/app.py", line 43, in reply
    res_msg = execute.predict(req_msg)
AttributeError: module 'execute' has no attribute 'predict'
127.0.0.1 - - [23/Jun/2022 22:31:51] "POST /message HTTP/1.1" 500 -
2022-06-23 22:32:00 - heartbeat
127.0.0.1 - - [23/Jun/2022 22:32:12] "GET /message HTTP/1.1" 405 -
2022-06-23 22:33:00 - heartbeat
2022-06-23 22:34:00 - heartbeat
ZhiyangLiang commented 2 years ago

请问您现在解决了吗 我也碰到类似的情况

60753b9e commented 2 years ago

暂时没有

gitarya commented 2 years ago

app.py import的execute是指上层的execute.py,不是pip install execute的这个包。在app.py最前面加上 sys.path.append("..")就可以了

Fuji-021 commented 6 months ago

app.py import的execute是指上层的execute.py,不是pip install execute的这个包。在app.py最前面加上 sys.path.append("..")就可以了

大佬,问一下我添加了这行代码,但是还是提示没有predict这个方法,是什么原因呢,麻烦您指教一下,非常感谢