from sklearn.linear_model import LogisticRegression
from sklearn.datasets import load_iris
X, y = load_iris(return_X_y=True)
clf = LogisticRegression(multi_class='multinomial', solver='lbfgs', max_iter=200)
clf.fit(X, y)
print(clf.predict(X[:5]))
$ python3 linear_classifier.py
/home/vagrant/.local/lib/python3.10/site-packages/sklearn/linear_model/_logistic.py:1272: FutureWarning: ‘multi_class’ was deprecated in version 1.5 and will be removed in 1.7. From then on, it will always use ‘multinomial’. Leave it to its default value to avoid this warning.
warnings.warn(
[0 0 0 0 0]
from gtts import gTTS
import os
text = "こんにちは、私はAIアバターです!"
tts = gTTS(text=text, lang='ja')
tts.save("output.mp3")
# os.system("start output.mp3") # For Windows
chat() の中で
認証チェックを追加
DBにユーザーの入力を保存
OpenAI API や HuggingFace API を呼んで応答を生成
生成した応答をDBに保存して返却
### step.0 テーブル作成
CREATE TABLE chat_messages (
id SERIAL PRIMARY KEY,
user_id VARCHAR(50) NOT NULL,
message TEXT NOT NULL,
reply TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
Definition of Scripts
A causally coherent set of events.
1. Each event sets off, or causes, the next event.
2. The causal connections between events make sense.
3. The parts are actions or scenes in the world.
Restaurant Script
Script: restaurant
track: formal dining
props: tables, menu, check, money, F = food, P = place
roles: S = customer, W = waiter, C = cook, M = cashier, O = owner
entry: S is hungry, S has money
result: S has less money, O has more money, S is not hungry, S is pleased
scenes: