質問編集履歴

3

質問を編集しました。

2021/12/30 07:48

投稿

Shuri31
Shuri31

スコア1

test CHANGED
File without changes
test CHANGED
@@ -15,282 +15,6 @@
15
15
 
16
16
 
17
17
  ![イメージ説明](9ba15e0e5b96ea8f8d87fa6cd225b642.png)
18
-
19
-
20
-
21
- ### 該当のソースコード
22
-
23
-
24
-
25
- ```python
26
-
27
- import streamlit as st
28
-
29
- import numpy as np
30
-
31
- import pandas as pd
32
-
33
- import sklearn
34
-
35
- from sklearn.ensemble import RandomForestRegressor
36
-
37
- from sklearn.metrics import mean_squared_error
38
-
39
-
40
-
41
-
42
-
43
- st.title("応募用紙に対する応募数を予測する")
44
-
45
-
46
-
47
- #回帰モデルの作成
48
-
49
-
50
-
51
- #データの読み込み
52
-
53
- train_y = pd.read_csv("train_y.csv", encoding="utf-8")
54
-
55
- train_X = pd.read_csv("train_x.csv", encoding="utf-8")
56
-
57
-
58
-
59
- #train_y["No."]をdropする
60
-
61
- train_y = train_y.drop(["No."], axis=1)
62
-
63
-
64
-
65
- #train_xのデータ整形(空白だけ・不要?なカラムの削除)
66
-
67
- train_X = train_X.dropna(axis=1, how='all')
68
-
69
- train_X = train_X.fillna(0)
70
-
71
- train_X = train_X.drop(["掲載期間 開始日", "掲載期間 終了日"], axis=1)
72
-
73
-
74
-
75
- #train_yとtrain_Xを連結して学習データとして利用する
76
-
77
- train = pd.concat([train_y.reset_index(drop=True), train_X.reset_index(drop=True)], axis=1)
78
-
79
-
80
-
81
- #データ変換と分割
82
-
83
- y = train["応募数 合計"]
84
-
85
- X = train.drop(["No.", "応募数 合計"], axis=1)
86
-
87
-
88
-
89
- y_array = np.array(y)
90
-
91
- X_array = np.array(X)
92
-
93
-
94
-
95
- #文章のデータ整形が難しかったので、文章のカラムを一括に学習データから外します。
96
-
97
- X_array = X.select_dtypes(exclude="object")
98
-
99
-
100
-
101
- from sklearn.model_selection import train_test_split
102
-
103
- X_train, X_test, y_train, y_test = train_test_split(X_array, y_array, test_size=0.4, random_state=0)
104
-
105
-
106
-
107
- #回帰モデル作成
108
-
109
- rfr = RandomForestRegressor(random_state=0)
110
-
111
- rfr.fit(X_train, y_train)
112
-
113
-
114
-
115
- y_pred = rfr.predict(X_test)
116
-
117
- # print(y_pred.shape)
118
-
119
-
120
-
121
- mse = np.sqrt(mean_squared_error(y_pred, y_test))
122
-
123
- st.write(f"Mean Squared Error:{mse:.3}")
124
-
125
-
126
-
127
- #ファイルがアップロードされるまでの処理を書く
128
-
129
- uploaded_file = st.file_uploader("Choose a file", type=["csv"])
130
-
131
-
132
-
133
- if uploaded_file is not None:
134
-
135
- test_X = pd.read_csv(uploaded_file).dropna(axis=1, how="all").fillna(0)
136
-
137
-
138
-
139
- #応募数合計の予測をするためのデータ成形
140
-
141
- test_X = test_X.drop(["掲載期間 開始日", "掲載期間 終了日"], axis=1)
142
-
143
-
144
-
145
- #文章のデータ整形が難しかったので、文章のカラムを一括に学習データから外します。
146
-
147
- test_X2 = test_X.drop(["No."], axis=1)
148
-
149
- test_X2 = test_X2.select_dtypes(exclude="object")
150
-
151
-
152
-
153
- #応募数合計の予測・データの予測
154
-
155
- test_pred = rfr.predict(test_X2)
156
-
157
- print(test_pred.shape)
158
-
159
-
160
-
161
- test_pred = pd.DataFrame(test_pred, columns=["応募数 合計"])
162
-
163
- result = pd.concat([test_X["No."], test_pred], axis=1)
164
-
165
- result = result.reset_index(drop=True)
166
-
167
-
168
-
169
- st.dataframe(result)
170
-
171
- st.download_button(label = '予測結果をダウンロード', data=result.to_csv(index=False).encode('utf-8'), file_name="result.csv")
172
-
173
- ```
174
-
175
-
176
-
177
- ```.gitignore
178
-
179
- *.csv
180
-
181
- ```
182
-
183
-
184
-
185
- ```Herokuのログ
186
-
187
- 2021-12-29T08:58:33.633044+00:00 app[worker.1]: streamlit run main.py [ARGUMENTS]
188
-
189
- 2021-12-29T08:58:33.633698+00:00 app[worker.1]: Traceback (most recent call last):
190
-
191
- 2021-12-29T08:58:33.633702+00:00 app[worker.1]: File "/app/main.py", line 19, in <module>
192
-
193
- 2021-12-29T08:58:33.633849+00:00 app[worker.1]: train_y = pd.read_csv("train_y.csv", encoding="utf-8")
194
-
195
- 2021-12-29T08:58:33.633854+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/util/_decorators.py", line 311, in wrapper
196
-
197
- 2021-12-29T08:58:33.633979+00:00 app[worker.1]: return func(*args, **kwargs)
198
-
199
- 2021-12-29T08:58:33.633989+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 586, in read_csv
200
-
201
- 2021-12-29T08:58:33.634151+00:00 app[worker.1]: return _read(filepath_or_buffer, kwds)
202
-
203
- 2021-12-29T08:58:33.634161+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 482, in _read
204
-
205
- 2021-12-29T08:58:33.634299+00:00 app[worker.1]: parser = TextFileReader(filepath_or_buffer, **kwds)
206
-
207
- 2021-12-29T08:58:33.634309+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 811, in __init__
208
-
209
- 2021-12-29T08:58:33.634517+00:00 app[worker.1]: self._engine = self._make_engine(self.engine)
210
-
211
- 2021-12-29T08:58:33.634533+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 1040, in _make_engine
212
-
213
- 2021-12-29T08:58:33.634756+00:00 app[worker.1]: return mapping[engine](self.f, **self.options) # type: ignore[call-arg]
214
-
215
- 2021-12-29T08:58:33.634758+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/c_parser_wrapper.py", line 51, in __init__
216
-
217
- 2021-12-29T08:58:33.634832+00:00 app[worker.1]: self._open_handles(src, kwds)
218
-
219
- 2021-12-29T08:58:33.634841+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/base_parser.py", line 222, in _open_handles
220
-
221
- 2021-12-29T08:58:33.634933+00:00 app[worker.1]: self.handles = get_handle(
222
-
223
- 2021-12-29T08:58:33.634943+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/common.py", line 702, in get_handle
224
-
225
- 2021-12-29T08:58:33.635111+00:00 app[worker.1]: handle = open(
226
-
227
- 2021-12-29T08:58:33.635145+00:00 app[worker.1]: FileNotFoundError: [Errno 2] No such file or directory: 'train_y.csv'
228
-
229
- 2021-12-29T09:11:36.477338+00:00 heroku[worker.1]: State changed from crashed to starting
230
-
231
- 2021-12-29T09:11:54.701484+00:00 heroku[worker.1]: Starting process with command `python main.py`
232
-
233
- 2021-12-29T09:11:55.332453+00:00 heroku[worker.1]: State changed from starting to up
234
-
235
- 2021-12-29T09:12:02.838739+00:00 heroku[worker.1]: Process exited with status 1
236
-
237
- 2021-12-29T09:12:02.460135+00:00 app[worker.1]: 2021-12-29 09:12:02.459
238
-
239
- 2021-12-29T09:12:02.460162+00:00 app[worker.1]: Warning: to view this Streamlit app on a browser, run it with the following
240
-
241
- 2021-12-29T09:12:02.460163+00:00 app[worker.1]: command:
242
-
243
- 2021-12-29T09:12:02.460163+00:00 app[worker.1]:
244
-
245
- 2021-12-29T09:12:02.460163+00:00 app[worker.1]: streamlit run main.py [ARGUMENTS]
246
-
247
- 2021-12-29T09:12:02.460876+00:00 app[worker.1]: Traceback (most recent call last):
248
-
249
- 2021-12-29T09:12:02.460880+00:00 app[worker.1]: File "/app/main.py", line 19, in <module>
250
-
251
- 2021-12-29T09:12:02.461008+00:00 app[worker.1]: train_y = pd.read_csv("train_y.csv", encoding="utf-8")
252
-
253
- 2021-12-29T09:12:02.461021+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/util/_decorators.py", line 311, in wrapper
254
-
255
- 2021-12-29T09:12:02.461149+00:00 app[worker.1]: return func(*args, **kwargs)
256
-
257
- 2021-12-29T09:12:02.461157+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 586, in read_csv
258
-
259
- 2021-12-29T09:12:02.461313+00:00 app[worker.1]: return _read(filepath_or_buffer, kwds)
260
-
261
- 2021-12-29T09:12:02.461322+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 482, in _read
262
-
263
- 2021-12-29T09:12:02.461506+00:00 app[worker.1]: parser = TextFileReader(filepath_or_buffer, **kwds)
264
-
265
- 2021-12-29T09:12:02.461508+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 811, in __init__
266
-
267
- 2021-12-29T09:12:02.463039+00:00 app[worker.1]: self._engine = self._make_engine(self.engine)
268
-
269
- 2021-12-29T09:12:02.463051+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 1040, in _make_engine
270
-
271
- 2021-12-29T09:12:02.463055+00:00 app[worker.1]: return mapping[engine](self.f, **self.options) # type: ignore[call-arg]
272
-
273
- 2021-12-29T09:12:02.463056+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/c_parser_wrapper.py", line 51, in __init__
274
-
275
- 2021-12-29T09:12:02.463056+00:00 app[worker.1]: self._open_handles(src, kwds)
276
-
277
- 2021-12-29T09:12:02.463056+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/base_parser.py", line 222, in _open_handles
278
-
279
- 2021-12-29T09:12:02.463057+00:00 app[worker.1]: self.handles = get_handle(
280
-
281
- 2021-12-29T09:12:02.463057+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/common.py", line 702, in get_handle
282
-
283
- 2021-12-29T09:12:02.463058+00:00 app[worker.1]: handle = open(
284
-
285
- 2021-12-29T09:12:02.463058+00:00 app[worker.1]: FileNotFoundError: [Errno 2] No such file or directory: 'train_y.csv'
286
-
287
- 2021-12-29T09:12:02.901159+00:00 heroku[worker.1]: State changed from up to crashed
288
-
289
- 2021-12-29T09:16:50.750172+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=dip-intern-asaitodev.herokuapp.com request_id=1d035980-620b-4c62-aaaf-b16be9ce2c11 fwd="92.202.111.147" dyno= connect= service= status=503 bytes= protocol=https
290
-
291
- 2021-12-29T09:16:51.189584+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=dip-intern-asaitodev.herokuapp.com request_id=3e6e253c-7beb-4d7a-a00d-819c15311d4f fwd="92.202.111.147" dyno= connect= service= status=503 bytes= protocol=https
292
-
293
- ```
294
18
 
295
19
 
296
20
 

2

.gitignoreを追加しました!

2021/12/30 07:48

投稿

Shuri31
Shuri31

スコア1

test CHANGED
File without changes
test CHANGED
@@ -174,6 +174,14 @@
174
174
 
175
175
 
176
176
 
177
+ ```.gitignore
178
+
179
+ *.csv
180
+
181
+ ```
182
+
183
+
184
+
177
185
  ```Herokuのログ
178
186
 
179
187
  2021-12-29T08:58:33.633044+00:00 app[worker.1]: streamlit run main.py [ARGUMENTS]

1

動かしたいアプリのコードを掲載しました。

2021/12/29 13:58

投稿

Shuri31
Shuri31

スコア1

test CHANGED
File without changes
test CHANGED
@@ -22,142 +22,294 @@
22
22
 
23
23
 
24
24
 
25
+ ```python
26
+
27
+ import streamlit as st
28
+
29
+ import numpy as np
30
+
31
+ import pandas as pd
32
+
33
+ import sklearn
34
+
35
+ from sklearn.ensemble import RandomForestRegressor
36
+
37
+ from sklearn.metrics import mean_squared_error
38
+
39
+
40
+
41
+
42
+
43
+ st.title("応募用紙に対する応募数を予測する")
44
+
45
+
46
+
47
+ #回帰モデルの作成
48
+
49
+
50
+
51
+ #データの読み込み
52
+
53
+ train_y = pd.read_csv("train_y.csv", encoding="utf-8")
54
+
55
+ train_X = pd.read_csv("train_x.csv", encoding="utf-8")
56
+
57
+
58
+
59
+ #train_y["No."]をdropする
60
+
61
+ train_y = train_y.drop(["No."], axis=1)
62
+
63
+
64
+
65
+ #train_xのデータ整形(空白だけ・不要?なカラムの削除)
66
+
67
+ train_X = train_X.dropna(axis=1, how='all')
68
+
69
+ train_X = train_X.fillna(0)
70
+
71
+ train_X = train_X.drop(["掲載期間 開始日", "掲載期間 終了日"], axis=1)
72
+
73
+
74
+
75
+ #train_yとtrain_Xを連結して学習データとして利用する
76
+
77
+ train = pd.concat([train_y.reset_index(drop=True), train_X.reset_index(drop=True)], axis=1)
78
+
79
+
80
+
81
+ #データ変換と分割
82
+
83
+ y = train["応募数 合計"]
84
+
85
+ X = train.drop(["No.", "応募数 合計"], axis=1)
86
+
87
+
88
+
89
+ y_array = np.array(y)
90
+
91
+ X_array = np.array(X)
92
+
93
+
94
+
95
+ #文章のデータ整形が難しかったので、文章のカラムを一括に学習データから外します。
96
+
97
+ X_array = X.select_dtypes(exclude="object")
98
+
99
+
100
+
101
+ from sklearn.model_selection import train_test_split
102
+
103
+ X_train, X_test, y_train, y_test = train_test_split(X_array, y_array, test_size=0.4, random_state=0)
104
+
105
+
106
+
107
+ #回帰モデル作成
108
+
109
+ rfr = RandomForestRegressor(random_state=0)
110
+
111
+ rfr.fit(X_train, y_train)
112
+
113
+
114
+
115
+ y_pred = rfr.predict(X_test)
116
+
117
+ # print(y_pred.shape)
118
+
119
+
120
+
121
+ mse = np.sqrt(mean_squared_error(y_pred, y_test))
122
+
123
+ st.write(f"Mean Squared Error:{mse:.3}")
124
+
125
+
126
+
127
+ #ファイルがアップロードされるまでの処理を書く
128
+
129
+ uploaded_file = st.file_uploader("Choose a file", type=["csv"])
130
+
131
+
132
+
133
+ if uploaded_file is not None:
134
+
135
+ test_X = pd.read_csv(uploaded_file).dropna(axis=1, how="all").fillna(0)
136
+
137
+
138
+
139
+ #応募数合計の予測をするためのデータ成形
140
+
141
+ test_X = test_X.drop(["掲載期間 開始日", "掲載期間 終了日"], axis=1)
142
+
143
+
144
+
145
+ #文章のデータ整形が難しかったので、文章のカラムを一括に学習データから外します。
146
+
147
+ test_X2 = test_X.drop(["No."], axis=1)
148
+
149
+ test_X2 = test_X2.select_dtypes(exclude="object")
150
+
151
+
152
+
153
+ #応募数合計の予測・データの予測
154
+
155
+ test_pred = rfr.predict(test_X2)
156
+
157
+ print(test_pred.shape)
158
+
159
+
160
+
161
+ test_pred = pd.DataFrame(test_pred, columns=["応募数 合計"])
162
+
163
+ result = pd.concat([test_X["No."], test_pred], axis=1)
164
+
165
+ result = result.reset_index(drop=True)
166
+
167
+
168
+
169
+ st.dataframe(result)
170
+
171
+ st.download_button(label = '予測結果をダウンロード', data=result.to_csv(index=False).encode('utf-8'), file_name="result.csv")
172
+
173
+ ```
174
+
175
+
176
+
177
+ ```Herokuのログ
178
+
179
+ 2021-12-29T08:58:33.633044+00:00 app[worker.1]: streamlit run main.py [ARGUMENTS]
180
+
181
+ 2021-12-29T08:58:33.633698+00:00 app[worker.1]: Traceback (most recent call last):
182
+
183
+ 2021-12-29T08:58:33.633702+00:00 app[worker.1]: File "/app/main.py", line 19, in <module>
184
+
185
+ 2021-12-29T08:58:33.633849+00:00 app[worker.1]: train_y = pd.read_csv("train_y.csv", encoding="utf-8")
186
+
187
+ 2021-12-29T08:58:33.633854+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/util/_decorators.py", line 311, in wrapper
188
+
189
+ 2021-12-29T08:58:33.633979+00:00 app[worker.1]: return func(*args, **kwargs)
190
+
191
+ 2021-12-29T08:58:33.633989+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 586, in read_csv
192
+
193
+ 2021-12-29T08:58:33.634151+00:00 app[worker.1]: return _read(filepath_or_buffer, kwds)
194
+
195
+ 2021-12-29T08:58:33.634161+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 482, in _read
196
+
197
+ 2021-12-29T08:58:33.634299+00:00 app[worker.1]: parser = TextFileReader(filepath_or_buffer, **kwds)
198
+
199
+ 2021-12-29T08:58:33.634309+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 811, in __init__
200
+
201
+ 2021-12-29T08:58:33.634517+00:00 app[worker.1]: self._engine = self._make_engine(self.engine)
202
+
203
+ 2021-12-29T08:58:33.634533+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 1040, in _make_engine
204
+
205
+ 2021-12-29T08:58:33.634756+00:00 app[worker.1]: return mapping[engine](self.f, **self.options) # type: ignore[call-arg]
206
+
207
+ 2021-12-29T08:58:33.634758+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/c_parser_wrapper.py", line 51, in __init__
208
+
209
+ 2021-12-29T08:58:33.634832+00:00 app[worker.1]: self._open_handles(src, kwds)
210
+
211
+ 2021-12-29T08:58:33.634841+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/base_parser.py", line 222, in _open_handles
212
+
213
+ 2021-12-29T08:58:33.634933+00:00 app[worker.1]: self.handles = get_handle(
214
+
215
+ 2021-12-29T08:58:33.634943+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/common.py", line 702, in get_handle
216
+
217
+ 2021-12-29T08:58:33.635111+00:00 app[worker.1]: handle = open(
218
+
219
+ 2021-12-29T08:58:33.635145+00:00 app[worker.1]: FileNotFoundError: [Errno 2] No such file or directory: 'train_y.csv'
220
+
221
+ 2021-12-29T09:11:36.477338+00:00 heroku[worker.1]: State changed from crashed to starting
222
+
223
+ 2021-12-29T09:11:54.701484+00:00 heroku[worker.1]: Starting process with command `python main.py`
224
+
225
+ 2021-12-29T09:11:55.332453+00:00 heroku[worker.1]: State changed from starting to up
226
+
227
+ 2021-12-29T09:12:02.838739+00:00 heroku[worker.1]: Process exited with status 1
228
+
229
+ 2021-12-29T09:12:02.460135+00:00 app[worker.1]: 2021-12-29 09:12:02.459
230
+
231
+ 2021-12-29T09:12:02.460162+00:00 app[worker.1]: Warning: to view this Streamlit app on a browser, run it with the following
232
+
233
+ 2021-12-29T09:12:02.460163+00:00 app[worker.1]: command:
234
+
235
+ 2021-12-29T09:12:02.460163+00:00 app[worker.1]:
236
+
237
+ 2021-12-29T09:12:02.460163+00:00 app[worker.1]: streamlit run main.py [ARGUMENTS]
238
+
239
+ 2021-12-29T09:12:02.460876+00:00 app[worker.1]: Traceback (most recent call last):
240
+
241
+ 2021-12-29T09:12:02.460880+00:00 app[worker.1]: File "/app/main.py", line 19, in <module>
242
+
243
+ 2021-12-29T09:12:02.461008+00:00 app[worker.1]: train_y = pd.read_csv("train_y.csv", encoding="utf-8")
244
+
245
+ 2021-12-29T09:12:02.461021+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/util/_decorators.py", line 311, in wrapper
246
+
247
+ 2021-12-29T09:12:02.461149+00:00 app[worker.1]: return func(*args, **kwargs)
248
+
249
+ 2021-12-29T09:12:02.461157+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 586, in read_csv
250
+
251
+ 2021-12-29T09:12:02.461313+00:00 app[worker.1]: return _read(filepath_or_buffer, kwds)
252
+
253
+ 2021-12-29T09:12:02.461322+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 482, in _read
254
+
255
+ 2021-12-29T09:12:02.461506+00:00 app[worker.1]: parser = TextFileReader(filepath_or_buffer, **kwds)
256
+
257
+ 2021-12-29T09:12:02.461508+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 811, in __init__
258
+
259
+ 2021-12-29T09:12:02.463039+00:00 app[worker.1]: self._engine = self._make_engine(self.engine)
260
+
261
+ 2021-12-29T09:12:02.463051+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 1040, in _make_engine
262
+
263
+ 2021-12-29T09:12:02.463055+00:00 app[worker.1]: return mapping[engine](self.f, **self.options) # type: ignore[call-arg]
264
+
265
+ 2021-12-29T09:12:02.463056+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/c_parser_wrapper.py", line 51, in __init__
266
+
267
+ 2021-12-29T09:12:02.463056+00:00 app[worker.1]: self._open_handles(src, kwds)
268
+
269
+ 2021-12-29T09:12:02.463056+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/base_parser.py", line 222, in _open_handles
270
+
271
+ 2021-12-29T09:12:02.463057+00:00 app[worker.1]: self.handles = get_handle(
272
+
273
+ 2021-12-29T09:12:02.463057+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/common.py", line 702, in get_handle
274
+
275
+ 2021-12-29T09:12:02.463058+00:00 app[worker.1]: handle = open(
276
+
277
+ 2021-12-29T09:12:02.463058+00:00 app[worker.1]: FileNotFoundError: [Errno 2] No such file or directory: 'train_y.csv'
278
+
279
+ 2021-12-29T09:12:02.901159+00:00 heroku[worker.1]: State changed from up to crashed
280
+
281
+ 2021-12-29T09:16:50.750172+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=dip-intern-asaitodev.herokuapp.com request_id=1d035980-620b-4c62-aaaf-b16be9ce2c11 fwd="92.202.111.147" dyno= connect= service= status=503 bytes= protocol=https
282
+
283
+ 2021-12-29T09:16:51.189584+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=dip-intern-asaitodev.herokuapp.com request_id=3e6e253c-7beb-4d7a-a00d-819c15311d4f fwd="92.202.111.147" dyno= connect= service= status=503 bytes= protocol=https
284
+
285
+ ```
286
+
287
+
288
+
289
+ ### 試したこと
290
+
291
+
292
+
293
+ ①code=14ということなので↓を記述
294
+
25
295
  ```bash
26
296
 
27
- 2021-12-29T08:58:33.633044+00:00 app[worker.1]: streamlit run main.py [ARGUMENTS]
28
-
29
- 2021-12-29T08:58:33.633698+00:00 app[worker.1]: Traceback (most recent call last):
30
-
31
- 2021-12-29T08:58:33.633702+00:00 app[worker.1]: File "/app/main.py", line 19, in <module>
32
-
33
- 2021-12-29T08:58:33.633849+00:00 app[worker.1]: train_y = pd.read_csv("train_y.csv", encoding="utf-8")
34
-
35
- 2021-12-29T08:58:33.633854+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/util/_decorators.py", line 311, in wrapper
36
-
37
- 2021-12-29T08:58:33.633979+00:00 app[worker.1]: return func(*args, **kwargs)
38
-
39
- 2021-12-29T08:58:33.633989+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 586, in read_csv
40
-
41
- 2021-12-29T08:58:33.634151+00:00 app[worker.1]: return _read(filepath_or_buffer, kwds)
42
-
43
- 2021-12-29T08:58:33.634161+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 482, in _read
44
-
45
- 2021-12-29T08:58:33.634299+00:00 app[worker.1]: parser = TextFileReader(filepath_or_buffer, **kwds)
46
-
47
- 2021-12-29T08:58:33.634309+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 811, in __init__
48
-
49
- 2021-12-29T08:58:33.634517+00:00 app[worker.1]: self._engine = self._make_engine(self.engine)
50
-
51
- 2021-12-29T08:58:33.634533+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 1040, in _make_engine
52
-
53
- 2021-12-29T08:58:33.634756+00:00 app[worker.1]: return mapping[engine](self.f, **self.options) # type: ignore[call-arg]
54
-
55
- 2021-12-29T08:58:33.634758+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/c_parser_wrapper.py", line 51, in __init__
56
-
57
- 2021-12-29T08:58:33.634832+00:00 app[worker.1]: self._open_handles(src, kwds)
58
-
59
- 2021-12-29T08:58:33.634841+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/base_parser.py", line 222, in _open_handles
60
-
61
- 2021-12-29T08:58:33.634933+00:00 app[worker.1]: self.handles = get_handle(
62
-
63
- 2021-12-29T08:58:33.634943+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/common.py", line 702, in get_handle
64
-
65
- 2021-12-29T08:58:33.635111+00:00 app[worker.1]: handle = open(
66
-
67
- 2021-12-29T08:58:33.635145+00:00 app[worker.1]: FileNotFoundError: [Errno 2] No such file or directory: 'train_y.csv'
68
-
69
- 2021-12-29T09:11:36.477338+00:00 heroku[worker.1]: State changed from crashed to starting
70
-
71
- 2021-12-29T09:11:54.701484+00:00 heroku[worker.1]: Starting process with command `python main.py`
72
-
73
- 2021-12-29T09:11:55.332453+00:00 heroku[worker.1]: State changed from starting to up
74
-
75
- 2021-12-29T09:12:02.838739+00:00 heroku[worker.1]: Process exited with status 1
76
-
77
- 2021-12-29T09:12:02.460135+00:00 app[worker.1]: 2021-12-29 09:12:02.459
78
-
79
- 2021-12-29T09:12:02.460162+00:00 app[worker.1]: Warning: to view this Streamlit app on a browser, run it with the following
80
-
81
- 2021-12-29T09:12:02.460163+00:00 app[worker.1]: command:
82
-
83
- 2021-12-29T09:12:02.460163+00:00 app[worker.1]:
84
-
85
- 2021-12-29T09:12:02.460163+00:00 app[worker.1]: streamlit run main.py [ARGUMENTS]
86
-
87
- 2021-12-29T09:12:02.460876+00:00 app[worker.1]: Traceback (most recent call last):
88
-
89
- 2021-12-29T09:12:02.460880+00:00 app[worker.1]: File "/app/main.py", line 19, in <module>
90
-
91
- 2021-12-29T09:12:02.461008+00:00 app[worker.1]: train_y = pd.read_csv("train_y.csv", encoding="utf-8")
92
-
93
- 2021-12-29T09:12:02.461021+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/util/_decorators.py", line 311, in wrapper
94
-
95
- 2021-12-29T09:12:02.461149+00:00 app[worker.1]: return func(*args, **kwargs)
96
-
97
- 2021-12-29T09:12:02.461157+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 586, in read_csv
98
-
99
- 2021-12-29T09:12:02.461313+00:00 app[worker.1]: return _read(filepath_or_buffer, kwds)
100
-
101
- 2021-12-29T09:12:02.461322+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 482, in _read
102
-
103
- 2021-12-29T09:12:02.461506+00:00 app[worker.1]: parser = TextFileReader(filepath_or_buffer, **kwds)
104
-
105
- 2021-12-29T09:12:02.461508+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 811, in __init__
106
-
107
- 2021-12-29T09:12:02.463039+00:00 app[worker.1]: self._engine = self._make_engine(self.engine)
108
-
109
- 2021-12-29T09:12:02.463051+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 1040, in _make_engine
110
-
111
- 2021-12-29T09:12:02.463055+00:00 app[worker.1]: return mapping[engine](self.f, **self.options) # type: ignore[call-arg]
112
-
113
- 2021-12-29T09:12:02.463056+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/c_parser_wrapper.py", line 51, in __init__
114
-
115
- 2021-12-29T09:12:02.463056+00:00 app[worker.1]: self._open_handles(src, kwds)
116
-
117
- 2021-12-29T09:12:02.463056+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/parsers/base_parser.py", line 222, in _open_handles
118
-
119
- 2021-12-29T09:12:02.463057+00:00 app[worker.1]: self.handles = get_handle(
120
-
121
- 2021-12-29T09:12:02.463057+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pandas/io/common.py", line 702, in get_handle
122
-
123
- 2021-12-29T09:12:02.463058+00:00 app[worker.1]: handle = open(
124
-
125
- 2021-12-29T09:12:02.463058+00:00 app[worker.1]: FileNotFoundError: [Errno 2] No such file or directory: 'train_y.csv'
126
-
127
- 2021-12-29T09:12:02.901159+00:00 heroku[worker.1]: State changed from up to crashed
128
-
129
- 2021-12-29T09:16:50.750172+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=dip-intern-asaitodev.herokuapp.com request_id=1d035980-620b-4c62-aaaf-b16be9ce2c11 fwd="92.202.111.147" dyno= connect= service= status=503 bytes= protocol=https
130
-
131
- 2021-12-29T09:16:51.189584+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=dip-intern-asaitodev.herokuapp.com request_id=3e6e253c-7beb-4d7a-a00d-819c15311d4f fwd="92.202.111.147" dyno= connect= service= status=503 bytes= protocol=https
297
+ $ heroku ps:scale web=1
132
298
 
133
299
  ```
134
300
 
135
301
 
136
302
 
137
- ### 試したこと
138
-
139
-
140
-
141
- code=14ということなので↓記述
303
+ ②Procfileを以下に変更
142
-
304
+
143
- ```bash
305
+ ```Procfile
144
-
306
+
145
- $ heroku ps:scale web=1
307
+ web: python main.py
146
308
 
147
309
  ```
148
310
 
149
311
 
150
312
 
151
- ②Procfileを以下に変更
152
-
153
- ```Procfile
154
-
155
- web: python main.py
156
-
157
- ```
158
-
159
-
160
-
161
313
  ③ Herokuの公開設定がONになっているかの確認(ONになっていました)
162
314
 
163
315