# Chatbot Deployment with Flask and JavaScript
In this tutorial we deploy the chatbot I created in [this](https://github.com/python-engineer/pytorch-chatbot) tutorial with Flask and JavaScript.
This gives 2 deployment options:
- Deploy within Flask app with jinja2 template
- Serve only the Flask prediction API. The used html and javascript files can be included in any Frontend application (with only a slight modification) and can run completely separate from the Flask App then.
## Initial Setup:
This repo currently contains the starter files.
Clone repo and create a virtual environment
```
$ git clone https://github.com/python-engineer/chatbot-deployment.git
$ cd chatbot-deployment
$ python3 -m venv venv
$ . venv/bin/activate
```
Install dependencies
```
$ (venv) pip install Flask torch torchvision nltk
```
Install nltk package
```
$ (venv) python
>>> import nltk
>>> nltk.download('punkt')
```
Modify `intents.json` with different intents and responses for your Chatbot
Run
```
$ (venv) python train.py
```
This will dump data.pth file. And then run
the following command to test it in the console.
```
$ (venv) python chat.py
```
Now for deployment follow my tutorial to implement `app.py` and `app.js`.
## Watch the Tutorial
[](https://youtu.be/a37BL0stIuM)
[https://youtu.be/a37BL0stIuM](https://youtu.be/a37BL0stIuM)
## Note
In the video we implement the first approach using jinja2 templates within our Flask app. Only slight modifications are needed to run the frontend separately. I put the final frontend code for a standalone frontend application in the [standalone-frontend](/standalone-frontend) folder.
## Credits:
This repo was used for the frontend code:
https://github.com/hitchcliff/front-end-chatjs

快撑死的鱼
- 粉丝: 2w+
- 资源: 9155
最新资源
- 基于Arduino设计的直流电压表毕业项目,原理图、源码-电路方案
- 基于深度学习和单目摄像头测距的前车碰撞预警系统源码详解(附设计文档),基于深度学习和单目摄像头测距的前车碰撞预警系统源码详解(GPU与CPU版本),前车碰撞预警-FCW,基于深度学习和单目摄像头测距
- RedPanda.C .3.2.win64.MinGW64-11.4.zip
- unixbench自动化脚本
- 毕业设计基于Python的Django-html基于知识图谱电影推荐问答系统源码(完整前后端+mysql+说明文档+LW+PPT).zip
- 青海统计年鉴2000-2020年
- 价值19800的影视视频微信小程序源码-自带支付通道带采集+搭建教程
- mingw-w64-x86-64-gmp-6.3.0-2-any.pkg.zip
- lua基础编程,包括lua的基本类型,语法,table,面向对象,协程,和c api
- 扫地机器人路径规划中遗传算法的应用与MATLAB实现-遗传算法-路径规划-扫地机器人-优化搜索-matlab
- 软考初级程序员 C程序设计(一)ppt
- spec2017工具cfg配置文件
- ltp20240524工具
- 西门子PLC STEP7编程软件梯形图与昆仑通态触摸屏电锅炉峰谷电供热系统全方案,CAD原理图全套包装解析,西门子PLC与昆仑通态触摸屏联控电锅炉供热系统:峰电供热与谷电蓄热水箱全自动蓄能程序CAD原
- HFI脉振方波高频注入与增强滑膜esmo代码:含原厂文档,TI与ST移植方式,学习资料大放送,HFI脉振方波高频注入与增强滑膜esmo代码:含原厂文档,可移植使用,支持TI与ST方式,HFI脉振方波高
- 2025年2月28日PPTX
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈


