Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
6099f22
Colab を使用して作成されました
YutzMame Apr 25, 2025
93037cb
Colab を使用して作成されました
YutzMame Apr 25, 2025
18bfcda
Colab を使用して作成されました
YutzMame Apr 25, 2025
cfe35be
Update app.py
YutzMame Apr 25, 2025
9c96884
Colab を使用して作成されました
YutzMame May 14, 2025
509e924
Merge branch 'matsuolab:master' into master
YutzMame May 20, 2025
c8ec572
Merge branch 'matsuolab:master' into master
yutsuryo May 20, 2025
2fc0419
nemuiyo
yutsuryo May 20, 2025
840f9f6
afa
yutsuryo May 21, 2025
b8202ac
gaga
yutsuryo May 21, 2025
bf51924
test_model.pyの修正
yutsuryo May 21, 2025
b684dfa
test.ymlの修正
yutsuryo May 21, 2025
a367376
test.ymlの修正2
yutsuryo May 21, 2025
5e8893b
gitactionsでの環境変数設定
yutsuryo May 21, 2025
9755333
test.ymlの修正3
yutsuryo May 21, 2025
58fb0ca
test.yml修正4
yutsuryo May 21, 2025
0bb6194
環境変数修正5
yutsuryo May 21, 2025
42ab55d
test.yml修正6
yutsuryo May 21, 2025
8e52537
修正7
yutsuryo May 21, 2025
0e887e3
8
yutsuryo May 21, 2025
d6c0298
9
yutsuryo May 21, 2025
083366b
10
yutsuryo May 21, 2025
99cffd5
11
yutsuryo May 21, 2025
ca4157c
12
yutsuryo May 21, 2025
de072e6
13
yutsuryo May 21, 2025
7315042
14
yutsuryo May 21, 2025
f9847a5
15
yutsuryo May 21, 2025
1b44530
16
yutsuryo May 21, 2025
995485d
17
yutsuryo May 21, 2025
0aa4d87
18
yutsuryo May 21, 2025
3ee8467
19
yutsuryo May 21, 2025
b39e758
20
yutsuryo May 21, 2025
0aa7265
ラスト
yutsuryo May 21, 2025
bfce92c
test.ymlの修正
yutsuryo May 27, 2025
d33b81a
blackでmain.pyを修正
yutsuryo May 27, 2025
e50470d
演習2 main.pyを編集
yutsuryo May 27, 2025
7c313a5
パスを変更
yutsuryo May 27, 2025
9eaf418
csv読み込み修正
yutsuryo May 27, 2025
357f7b5
black実行
yutsuryo May 27, 2025
066cc0f
test.ymlを編集
yutsuryo May 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added .github/workflows/a
Empty file.
23 changes: 15 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
# push:
# branches: [ main, master ]
pull_request:
branches: [ main, master ]
branches: [ main, master,develop ]

jobs:
test:
Expand All @@ -25,17 +25,24 @@ jobs:

- name: Lint with flake8
run: |
flake8 day5/演習3 --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 day5/演習3 --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics
flake8 day5/演習2 --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 day5/演習2 --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics

- name: Format check with black
run: |
black --check day5/演習3
black --check day5/演習2

- name: Run data tests
# - name: Run data tests
# run: |
# pytest day5/演習2/tests/test_data.py -v

# - name: Run model tests
# run: |
# pytest day5/演習2/tests/test_model.py -v
- name: Run main.py
run: |
pytest day5/演習3/tests/test_data.py -v
python day5/演習2/main.py -v

- name: Run model tests
- name: Run pytest on main.py
run: |
pytest day5/演習3/tests/test_model.py -v
pytest day5/演習2/main.py -v
86 changes: 43 additions & 43 deletions day1/01_streamlit_UI/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,48 +15,48 @@
# ============================================
# タイトルと説明
# ============================================
st.title("Streamlit 初心者向けデモ")
st.markdown("### コメントを解除しながらStreamlitの機能を学びましょう")
st.markdown("このデモコードでは、コメントアウトされた部分を順番に解除しながらUIの変化を確認できます。")
st.title("個人情報アンケート")
st.markdown("### 個人情報を打ち込んで、整理しましょう")
st.markdown("このサイトでは、個人情報を入力していくことで、他の個人情報を入力する場面での入力をスムーズにします。")

# ============================================
# サイドバー
# ============================================
st.sidebar.header("デモのガイド")
st.sidebar.info("コードのコメントを解除して、Streamlitのさまざまな機能を確認しましょう。")
st.sidebar.header("サイトのガイド")
st.sidebar.info("個人情報を入力していくことで、他の個人情報を入力する場面での入力をスムーズにしましょう。")

# ============================================
# 基本的なUI要素
# ============================================
st.header("基本的なUI要素")
st.header("個人情報入力欄")

# テキスト入力
st.subheader("テキスト入力")
st.subheader("個人情報は大切にしてください")
name = st.text_input("あなたの名前", "ゲスト")
st.write(f"こんにちは、{name}さん!")

# ボタン
# st.subheader("ボタン")
# if st.button("クリックしてください"):
# st.success("ボタンがクリックされました!")
st.subheader("個人情報を入力しちゃうんですか?")
if st.button("はい"):
st.success("変わってますね!")

# チェックボックス
# st.subheader("チェックボックス")
# if st.checkbox("チェックを入れると追加コンテンツが表示されます"):
# st.info("これは隠れたコンテンツです!")
st.subheader("個人情報を入力することに躊躇いがある")
if st.checkbox("当てはまる場合はチェックを入れてください"):
st.info("なぜこんなサイトを訪れたんですか?")

# スライダー
# st.subheader("スライダー")
# age = st.slider("年齢", 0, 100, 25)
# st.write(f"あなたの年齢: {age}")
st.subheader("自身の年齢にスライダーを合わせてください")
age = st.slider("年齢", 0, 100, 25)
st.write(f"あなたの年齢は{age}歳です!覚えておいてくださいね!")

# セレクトボックス
# st.subheader("セレクトボックス")
# option = st.selectbox(
# "好きなプログラミング言語は?",
# ["Python", "JavaScript", "Java", "C++", "Go", "Rust"]
# )
# st.write(f"あなたは{option}を選びました")
st.subheader("性別")
option = st.selectbox(
"あなたの性別は?",
[ "男", "", "その他"]
)
st.write(f"あなたは{option}です。わかりましたか?")

# ============================================
# レイアウト
Expand All @@ -82,22 +82,22 @@
# st.write("これは第2タブの内容です")

# エクスパンダー
# st.subheader("エクスパンダー")
# with st.expander("詳細を表示"):
# st.write("これはエクスパンダー内の隠れたコンテンツです")
# st.code("print('Hello, Streamlit!')")
st.subheader("その他")
with st.expander("詳細を表示"):
st.write("もう入力するのは終わりです、、、")
st.code("print('お疲れ様でした')")

# ============================================
# データ表示
# ============================================
# st.header("データの表示")

# サンプルデータフレームを作成
# df = pd.DataFrame({
# '名前': ['田中', '鈴木', '佐藤', '高橋', '伊藤'],
# '年齢': [25, 30, 22, 28, 33],
# '都市': ['東京', '大阪', '福岡', '札幌', '名古屋']
# })
df = pd.DataFrame({
'名前': ['田中', '鈴木', '佐藤', '高橋', '伊藤'],
'年齢': [25, 30, 22, 28, 33],
'都市': ['東京', '大阪', '福岡', '札幌', '名古屋']
})

# データフレーム表示
# st.subheader("データフレーム")
Expand Down Expand Up @@ -183,21 +183,21 @@
# ============================================
# デモの使用方法
# ============================================
st.divider()
st.subheader("このデモの使い方")
st.markdown("""
1. コードエディタでコメントアウトされた部分を見つけます(#で始まる行)
2. 確認したい機能のコメントを解除します(先頭の#を削除)
3. 変更を保存して、ブラウザで結果を確認します
4. 様々な組み合わせを試して、UIがどのように変化するか確認しましょう
""")
# st.divider()
# st.subheader("このデモの使い方")
# st.markdown("""
# 1. コードエディタでコメントアウトされた部分を見つけます(#で始まる行)
# 2. 確認したい機能のコメントを解除します(先頭の#を削除)
# 3. 変更を保存して、ブラウザで結果を確認します
#4. 様々な組み合わせを試して、UIがどのように変化するか確認しましょう
# """)

st.code("""
# st.code("""
# コメントアウトされた例:
# if st.button("クリックしてください"):
# st.success("ボタンがクリックされました!")

# コメントを解除した例:
if st.button("クリックしてください"):
st.success("ボタンがクリックされました!")
""")
# if st.button("クリックしてください"):
# st.success("ボタンがクリックされました!")
# """)
166 changes: 145 additions & 21 deletions day1/day1_practice.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,38 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "bvEowFfg5lrq"
},
"outputs": [],
"execution_count": 4,
"metadata": {
"id": "bvEowFfg5lrq",
"colab": {
"base_uri": "https://localhost:8080/"
},
"outputId": "fb6acecb-d475-4b34-e90c-7f673140fe6a"
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Collecting python-dotenv\n",
" Downloading python_dotenv-1.1.0-py3-none-any.whl.metadata (24 kB)\n",
"Downloading python_dotenv-1.1.0-py3-none-any.whl (20 kB)\n",
"Installing collected packages: python-dotenv\n",
"Successfully installed python-dotenv-1.1.0\n",
"/content/lecture-ai-engineering/day1\n"
]
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"True"
]
},
"metadata": {},
"execution_count": 4
}
],
"source": [
"!pip install python-dotenv\n",
"from dotenv import load_dotenv, find_dotenv\n",
Expand All @@ -141,11 +168,23 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "S28XgOm0ELSM"
},
"outputs": [],
"execution_count": 5,
"metadata": {
"id": "S28XgOm0ELSM",
"colab": {
"base_uri": "https://localhost:8080/"
},
"outputId": "c8086931-df0a-4d1b-b471-7806a0dc0268"
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"/content/lecture-ai-engineering/day1/01_streamlit_UI\n"
]
}
],
"source": [
"%cd /content/lecture-ai-engineering/day1/01_streamlit_UI"
]
Expand All @@ -161,7 +200,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {
"id": "nBe41LFiELSN"
},
Expand All @@ -182,11 +221,23 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "aYw1q0iXELSN"
},
"outputs": [],
"execution_count": 7,
"metadata": {
"id": "aYw1q0iXELSN",
"colab": {
"base_uri": "https://localhost:8080/"
},
"outputId": "40578aa1-2a46-46ef-c376-c986614e0f79"
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Authtoken saved to configuration file: /root/.config/ngrok/ngrok.yml\n"
]
}
],
"source": [
"!ngrok authtoken $$NGROK_TOKEN"
]
Expand All @@ -204,9 +255,68 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "f-E7ucR6ELSN"
},
"outputs": [],
"id": "f-E7ucR6ELSN",
"colab": {
"base_uri": "https://localhost:8080/"
},
"outputId": "c85d6711-55e6-4787-abe6-aa66510bcb93"
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"公開URL: https://a54b-35-233-225-230.ngrok-free.app\n",
"\n",
"Collecting usage statistics. To deactivate, set browser.gatherUsageStats to false.\n",
"\u001b[0m\n",
"\u001b[0m\n",
"\u001b[34m\u001b[1m You can now view your Streamlit app in your browser.\u001b[0m\n",
"\u001b[0m\n",
"\u001b[34m Local URL: \u001b[0m\u001b[1mhttp://localhost:8501\u001b[0m\n",
"\u001b[34m Network URL: \u001b[0m\u001b[1mhttp://172.28.0.12:8501\u001b[0m\n",
"\u001b[34m External URL: \u001b[0m\u001b[1mhttp://35.233.225.230:8501\u001b[0m\n",
"\u001b[0m\n",
"2025-04-25 04:08:15.825 Script compilation error\n",
"Traceback (most recent call last):\n",
" File \"/usr/local/lib/python3.11/dist-packages/streamlit/runtime/scriptrunner/script_runner.py\", line 549, in _run_script\n",
" code = self._script_cache.get_bytecode(script_path)\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"/usr/local/lib/python3.11/dist-packages/streamlit/runtime/scriptrunner/script_cache.py\", line 72, in get_bytecode\n",
" filebody = magic.add_magic(filebody, script_path)\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"/usr/local/lib/python3.11/dist-packages/streamlit/runtime/scriptrunner/magic.py\", line 46, in add_magic\n",
" tree = ast.parse(code, script_path, \"exec\")\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"/usr/lib/python3.11/ast.py\", line 50, in parse\n",
" return compile(source, filename, mode, flags,\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"/content/lecture-ai-engineering/day1/01_streamlit_UI/app.py\", line 39\n",
" st.subheader(\"ボタン\")\n",
"IndentationError: unexpected indent\n",
"2025-04-25 04:08:15.829 Thread 'MainThread': missing ScriptRunContext! This warning can be ignored when running in bare mode.\n",
"2025-04-25 04:08:23.075 Script compilation error\n",
"Traceback (most recent call last):\n",
" File \"/usr/local/lib/python3.11/dist-packages/streamlit/runtime/scriptrunner/script_runner.py\", line 549, in _run_script\n",
" code = self._script_cache.get_bytecode(script_path)\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"/usr/local/lib/python3.11/dist-packages/streamlit/runtime/scriptrunner/script_cache.py\", line 72, in get_bytecode\n",
" filebody = magic.add_magic(filebody, script_path)\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"/usr/local/lib/python3.11/dist-packages/streamlit/runtime/scriptrunner/magic.py\", line 46, in add_magic\n",
" tree = ast.parse(code, script_path, \"exec\")\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"/usr/lib/python3.11/ast.py\", line 50, in parse\n",
" return compile(source, filename, mode, flags,\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"/content/lecture-ai-engineering/day1/01_streamlit_UI/app.py\", line 39\n",
" st.subheader(\"ボタン\")\n",
"IndentationError: unexpected indent\n",
"2025-04-25 04:08:23.077 Thread 'MainThread': missing ScriptRunContext! This warning can be ignored when running in bare mode.\n",
"2025-04-25 04:08:56.234 Received event for non-watched file: /content/lecture-ai-engineering/day1/01_streamlit_UI/app.py\n"
]
}
],
"source": [
"from pyngrok import ngrok\n",
"\n",
Expand All @@ -215,6 +325,18 @@
"!streamlit run app.py"
]
},
{
"cell_type": "code",
"source": [
"from google.colab import drive\n",
"drive.mount('/content/drive')"
],
"metadata": {
"id": "OSCJrRYSTrgo"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
Expand Down Expand Up @@ -391,7 +513,9 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"id": "-N8qKmC6HrJ7"
},
"source": [
"アプリケーションの機能としては、チャット機能や履歴閲覧があります。\n",
"\n",
Expand Down Expand Up @@ -567,4 +691,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}
Binary file modified day5/演習1/models/titanic_model.pkl
Binary file not shown.
Loading