CaxtonEmeraldS commited on
Commit
d679dee
·
verified ·
1 Parent(s): 84e915c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -64,7 +64,11 @@ def predict(r, g, b, activation, seed, neurons):
64
  model = tf.keras.models.load_model(keras_path)
65
  ann_pred = model.predict(X)[0][0]
66
 
67
- # Rescale cholestrol concentration prediction in mM
 
 
 
 
68
  return ann_pred*50, lin_pred_rgb*50
69
 
70
  except Exception as e:
@@ -80,7 +84,7 @@ def update_neurons(activation, seed):
80
 
81
  # Gradio Interface
82
  with gr.Blocks() as demo:
83
- gr.Markdown("# Cholestrol Concentration Prediction - ANN and Linear Model")
84
  gr.Markdown("# **Cholestrol Concentration Prediction - ANN and Linear Model**")
85
  gr.Markdown("Dynamically select models and predict cholesterol concentration.")
86
 
@@ -124,6 +128,8 @@ Professor, Centre for Nanoscience and Technology, Pondicherry University, Puduch
124
  ann_output = gr.Text(label="Cholestrol Conentration (mM) - ANN Model Prediction ")
125
  lin_rgb_output = gr.Text(label="Cholestrol Conentration (mM) - Linear Model Prediction")
126
 
 
 
127
  btn.click(
128
  fn=predict,
129
  inputs=[r, g, b, activation, seed, neurons],
 
64
  model = tf.keras.models.load_model(keras_path)
65
  ann_pred = model.predict(X)[0][0]
66
 
67
+ # Rescale cholestrol concentration prediction in mM and adjust to zero if negative
68
+ if ann_pred < 0:
69
+ ann_pred = 0;
70
+ if lin_pred_rgb < 0:
71
+ lin_pred_rgb = 0;
72
  return ann_pred*50, lin_pred_rgb*50
73
 
74
  except Exception as e:
 
84
 
85
  # Gradio Interface
86
  with gr.Blocks() as demo:
87
+ # gr.Markdown("# Cholestrol Concentration Prediction - ANN and Linear Model")
88
  gr.Markdown("# **Cholestrol Concentration Prediction - ANN and Linear Model**")
89
  gr.Markdown("Dynamically select models and predict cholesterol concentration.")
90
 
 
128
  ann_output = gr.Text(label="Cholestrol Conentration (mM) - ANN Model Prediction ")
129
  lin_rgb_output = gr.Text(label="Cholestrol Conentration (mM) - Linear Model Prediction")
130
 
131
+ gr.Markdown("* Predicted negative concentration adjusted to zero.")
132
+
133
  btn.click(
134
  fn=predict,
135
  inputs=[r, g, b, activation, seed, neurons],