Update app.py
Browse files
app.py
CHANGED
@@ -239,3 +239,43 @@ elif regression_type == "Random Forest Regression":
|
|
239 |
axes[1].set_title('HSV Values')
|
240 |
|
241 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
axes[1].set_title('HSV Values')
|
240 |
|
241 |
|
242 |
+
|
243 |
+
if uploaded_file is not None:
|
244 |
+
# CSV 파일 읽기
|
245 |
+
data = pd.read_csv(uploaded_file)
|
246 |
+
st.write("Data Preview:")
|
247 |
+
st.write(data.head())
|
248 |
+
|
249 |
+
# 데이터 시각화 (RGB & HSV)
|
250 |
+
fig, axes = plt.subplots(2, 1, figsize=(10, 8))
|
251 |
+
|
252 |
+
# RGB 차트
|
253 |
+
axes[0].plot(data['R'], 'r', label='R')
|
254 |
+
axes[0].plot(data['G'], 'g', label='G')
|
255 |
+
axes[0].plot(data['B'], 'b', label='B')
|
256 |
+
axes[0].legend(loc='upper right')
|
257 |
+
axes[0].set_title('RGB Values')
|
258 |
+
|
259 |
+
# HSV 차트
|
260 |
+
axes[1].plot(data['H'], 'r', label='H')
|
261 |
+
axes[1].plot(data['S'], 'g', label='S')
|
262 |
+
axes[1].plot(data['V'], 'b', label='V')
|
263 |
+
axes[1].legend(loc='upper right')
|
264 |
+
axes[1].set_title('HSV Values')
|
265 |
+
|
266 |
+
st.pyplot(fig)
|
267 |
+
|
268 |
+
X = np.arange(len(data)).reshape(-1, 1)
|
269 |
+
|
270 |
+
# Linear Regression
|
271 |
+
if regression_type == "Linear Regression":
|
272 |
+
model = LinearRegression()
|
273 |
+
model.fit(X, data['R'])
|
274 |
+
axes[0].plot(X, model.predict(X), 'r--')
|
275 |
+
model.fit(X, data['G'])
|
276 |
+
axes[0].plot(X, model.predict(X), 'g--')
|
277 |
+
model.fit(X, data['B'])
|
278 |
+
axes[0].plot(X, model.predict(X), 'b--')
|
279 |
+
st.write(f"Linear equation: y = {model.coef_[0]} * x + {model.intercept_}")
|
280 |
+
|
281 |
+
# Other regression types...
|