Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Deploying sentiment analysis server with FastAPI and BERT

License

NotificationsYou must be signed in to change notification settings

izuna385/Japanese-BERT-Sentiment-Analyzer

Repository files navigation

  • twitterデータセットを用いたポジ/ネガ/中性の判定モデル

手順

データセットのダウンロード

  • 鈴木研ホームページ よりデータセットを利用させて頂いています。

  • ./dataset/ を詳しくは御覧ください。

実験環境

$condacreate-nallennlppython=3.7$condaactivateallennlp$pipinstall-rrequirements.txt

実験

$ python3 train.py

ここまでで、訓練されたモデルのパラメータが./serialization_dir/ 下に保存される

APIのコンテナ化

$ docker build -t jsa:latest .$ docker run -d -itd -p 8000:8000 jsa

(コンテナ化しない場合)

$ uvicorn app:app --reload --port 8000 --host 0.0.0.0 --log-level trace

使用法

$ curl -X 'POST' 'http://localhost:8000/sentiment/' -H 'accept: application/json' \       -H 'Content-Type: application/json' \       -d '{            "sentence": "今日はいい天気"           }'>> {"probs":        {         "neutral":0.8089876174926758,         "negative":0.015650086104869843,         "positive":0.17536230385303497         }    }

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp