Skip to content

fix: Add navigation button from Labour Scheduling & Alerts to Main Page #112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Labour_Alerts/templates/labour.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

<header>
<h1>Labour Scheduling & Alerts</h1>
<button id="backToMain" onclick="location.href='/main'">Back to Main Page</button>

</header>

<div class="container">
Expand Down
19 changes: 17 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,31 @@
os.makedirs(UPLOAD_FOLDER, exist_ok=True)

# Load the Keras model
model = load_keras_model(r'disease/model.h5')
try:
model = load_keras_model(r'disease/model.h5')
except FileNotFoundError:
model = None
print("Warning: model.h5 not found, continuing without model.")


# Route for homepage


@app.route('/')
def index():
return render_template('index.html')


@app.route('/main')
def main():
return render_template('main.html')
# Route for prediction


@app.route('/predict', methods=['POST'])
def predict():
if model is None:
return "Model not loaded.Prediction is unavailable."
if 'file' not in request.files:
return "No file uploaded."
file = request.files['file']
Expand All @@ -37,4 +52,4 @@ def predict():


if __name__ == '__main__':
app.run(debug=True)
app.run(debug=True)