JUNGU commited on
Commit
d0b2038
·
1 Parent(s): 3deb8b3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -1,4 +1,3 @@
1
-
2
  import streamlit as st
3
  import pandas as pd
4
  import numpy as np
@@ -24,7 +23,7 @@ def fit_model(data, model_type, x_values, y_values):
24
  x_values = x_values.reshape(-1, 1)
25
  model.fit(x_values, y_values)
26
  prediction = model.predict(x_values)
27
- equation = f'y = {{model.coef_[0]:.4f}}x + {{model.intercept_:.4f}}'
28
  elif model_type == 'Polynomial Regression':
29
  polynomial_features = PolynomialFeatures(degree=2)
30
  x_values_poly = polynomial_features.fit_transform(x_values.reshape(-1, 1))
@@ -48,7 +47,7 @@ def app():
48
 
49
  # Selecting R, G, B, H, S, V
50
  color_component = st.selectbox("Select color component", ['R', 'G', 'B', 'H', 'S', 'V'])
51
- st.write(f"Selected component: {{color_component}}")
52
  selected_data = data[color_component].values
53
 
54
  # Selecting regression model
@@ -59,10 +58,10 @@ def app():
59
 
60
  # Fitting the selected model
61
  model, prediction, equation = fit_model(data, regression_model, x_values, y_values)
62
- st.write(f"Equation: {{equation}}")
63
 
64
  # Plotting the data and model
65
  plot_data(data, x_values, y_values, model, prediction)
66
 
67
- # Running the app (uncomment this line to run the app locally)
68
  # app()
 
 
1
  import streamlit as st
2
  import pandas as pd
3
  import numpy as np
 
23
  x_values = x_values.reshape(-1, 1)
24
  model.fit(x_values, y_values)
25
  prediction = model.predict(x_values)
26
+ equation = f'y = {model.coef_[0]:.4f}x + {model.intercept_:.4f}'
27
  elif model_type == 'Polynomial Regression':
28
  polynomial_features = PolynomialFeatures(degree=2)
29
  x_values_poly = polynomial_features.fit_transform(x_values.reshape(-1, 1))
 
47
 
48
  # Selecting R, G, B, H, S, V
49
  color_component = st.selectbox("Select color component", ['R', 'G', 'B', 'H', 'S', 'V'])
50
+ st.write(f"Selected component: {color_component}")
51
  selected_data = data[color_component].values
52
 
53
  # Selecting regression model
 
58
 
59
  # Fitting the selected model
60
  model, prediction, equation = fit_model(data, regression_model, x_values, y_values)
61
+ st.write(f"Equation: {equation}")
62
 
63
  # Plotting the data and model
64
  plot_data(data, x_values, y_values, model, prediction)
65
 
66
+ # Uncomment the next line to run the app locally
67
  # app()