https://github.com/mizuhara1314/livechat_sentiment_analysis_web
大四單人畢設,基於bert_lstm模型的直播實時情感分析網站
https://github.com/mizuhara1314/livechat_sentiment_analysis_web
flask
Last synced: 5 months ago
JSON representation
大四單人畢設,基於bert_lstm模型的直播實時情感分析網站
- Host: GitHub
- URL: https://github.com/mizuhara1314/livechat_sentiment_analysis_web
- Owner: mizuhara1314
- Created: 2024-09-11T13:05:59.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-24T13:10:45.000Z (over 1 year ago)
- Last Synced: 2025-03-25T11:11:22.066Z (over 1 year ago)
- Topics: flask
- Language: Python
- Homepage:
- Size: 80.1 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 1. 簡介:
使用之前訓練好的bert_lstm情感模型來實時預測yt跟twitch直播間的觀眾情緒,更新間格為10秒,測試文本在upload的test.txt裡
# 2. 效果:
https://github.com/user-attachments/assets/4375435d-bafa-4060-b62d-2ee9b7b90a6b


# 3. 運行項目:
### 注意事項 ###
先至anaconda3\Lib\site-packages\pytchat\core文件夾下的pytchat.py中删除这一部分代码(否則會出現"signal only works in main thread of the main interpreter")
```bash
if interruptable:
signal.signal(signal.SIGINT, lambda a, b: self.terminate())
```
然後至 https://drive.google.com/file/d/1lnJuSLQKl6Xi-o9SYQ3hwElazgswvjKf/view?usp=sharing 下載模型,並解壓到項目根目錄下讓app.py讀取
然後在工作環境選擇conda interpreter
在 Flask 後端項目下運行後端代碼:
```bash
python app.py
```
會運行在本機port 7000
或是
```bash
python -m flask run
```
會默認運行在port 5000
然後在瀏覽器開啟localhost即可:
# 4. 缺點:
載入模型功能模塊時無法讀取bert_classfier類(動態連結問題?),得加個setattr()解決這bug
# 5. 改進
未來可以使用像kafka之類的實時流數據框架或者類似c#的sinalR/websocket通訊來取代ajax/axios需要定時輪循達成監聽