eaglelandsonce commited on
Commit
28dd67d
·
verified ·
1 Parent(s): efe2cc6

Update pages/6_Logistic_Regression.py

Browse files
Files changed (1) hide show
  1. pages/6_Logistic_Regression.py +9 -6
pages/6_Logistic_Regression.py CHANGED
@@ -50,7 +50,7 @@ For this example, we'll only use the Setosa and Versicolor classes.
50
  st.write("### Flower Images")
51
  col1, col2 = st.columns(2)
52
  with col1:
53
- st.image("https://en.wikipedia.org/wiki/File:Irissetosa1.jpg", caption="Iris Setosa", use_column_width=True)
54
  with col2:
55
  st.image("https://upload.wikimedia.org/wikipedia/commons/4/41/Iris_versicolor_3.jpg", caption="Iris Versicolor", use_column_width=True)
56
 
@@ -76,11 +76,14 @@ model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy']
76
  # Display the model architecture
77
  st.write("### Model Architecture")
78
  st.write(model.summary())
79
- fig, ax = plt.subplots()
80
- buf = io.BytesIO()
81
- plot_model(model, to_file=buf, show_shapes=True, show_layer_names=True)
82
- buf.seek(0)
83
- st.image(buf, caption='Logistic Regression Model Architecture', use_column_width=True)
 
 
 
84
 
85
  # Train the model
86
  model.fit(X_train, y_train, epochs=epochs, verbose=0)
 
50
  st.write("### Flower Images")
51
  col1, col2 = st.columns(2)
52
  with col1:
53
+ st.image("https://upload.wikimedia.org/wikipedia/commons/4/49/Iris_setosa_2.jpg", caption="Iris Setosa", use_column_width=True)
54
  with col2:
55
  st.image("https://upload.wikimedia.org/wikipedia/commons/4/41/Iris_versicolor_3.jpg", caption="Iris Versicolor", use_column_width=True)
56
 
 
76
  # Display the model architecture
77
  st.write("### Model Architecture")
78
  st.write(model.summary())
79
+ try:
80
+ fig, ax = plt.subplots()
81
+ buf = io.BytesIO()
82
+ plot_model(model, to_file=buf, show_shapes=True, show_layer_names=True)
83
+ buf.seek(0)
84
+ st.image(buf, caption='Logistic Regression Model Architecture', use_column_width=True)
85
+ except ImportError:
86
+ st.warning('Graphviz is not installed. Model architecture visualization is skipped.')
87
 
88
  # Train the model
89
  model.fit(X_train, y_train, epochs=epochs, verbose=0)