Update app.py
Browse files
app.py
CHANGED
|
@@ -43,21 +43,19 @@ async def load_models():
|
|
| 43 |
try:
|
| 44 |
from transformers import pipeline
|
| 45 |
|
| 46 |
-
#
|
| 47 |
print("📥 軽量感情分析モデルをロード中...")
|
| 48 |
sentiment_classifier = pipeline(
|
| 49 |
"sentiment-analysis",
|
| 50 |
-
model="prajjwal1/bert-tiny"
|
| 51 |
-
cache_dir="/app/.cache"
|
| 52 |
)
|
| 53 |
print("✅ 感情分析モデル読み込み完了")
|
| 54 |
|
| 55 |
-
#
|
| 56 |
print("📥 軽量テキスト生成モデルをロード中...")
|
| 57 |
text_generator = pipeline(
|
| 58 |
"text-generation",
|
| 59 |
-
model="sshleifer/tiny-gpt2"
|
| 60 |
-
cache_dir="/app/.cache"
|
| 61 |
)
|
| 62 |
print("✅ テキスト生成モデル読み込み完了")
|
| 63 |
|
|
|
|
| 43 |
try:
|
| 44 |
from transformers import pipeline
|
| 45 |
|
| 46 |
+
# 非常に軽量な感情分析モデル(cache_dirを削除)
|
| 47 |
print("📥 軽量感情分析モデルをロード中...")
|
| 48 |
sentiment_classifier = pipeline(
|
| 49 |
"sentiment-analysis",
|
| 50 |
+
model="prajjwal1/bert-tiny"
|
|
|
|
| 51 |
)
|
| 52 |
print("✅ 感情分析モデル読み込み完了")
|
| 53 |
|
| 54 |
+
# 軽量テキスト生成モデル(cache_dirを削除)
|
| 55 |
print("📥 軽量テキスト生成モデルをロード中...")
|
| 56 |
text_generator = pipeline(
|
| 57 |
"text-generation",
|
| 58 |
+
model="sshleifer/tiny-gpt2"
|
|
|
|
| 59 |
)
|
| 60 |
print("✅ テキスト生成モデル読み込み完了")
|
| 61 |
|