Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

application.py 1.3 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
  1. from datetime import datetime
  2. import streamlit as st
  3. import os
  4. import numpy as np
  5. from src.mlProject.pipeline.prediction import PredictionPipeline
  6. st.set_page_config(
  7. page_title="Hourly Consumption Prediction",
  8. page_icon="⏰",
  9. layout="centered",
  10. initial_sidebar_state="auto",
  11. )
  12. st.title("Hourly Consumption Prediction")
  13. # Sidebar
  14. st.sidebar.header("Navigation")
  15. app_mode = st.sidebar.selectbox("Choose an option", ["Home", "Train Model", "Predict"])
  16. if app_mode == "Home":
  17. st.write("Welcome to the Hourly Consumption Prediction App!")
  18. if app_mode == "Train Model":
  19. if st.button("Train Model"):
  20. os.system("python main.py")
  21. st.success("Training Successful!")
  22. if app_mode == "Predict":
  23. st.write("Fill in the select the Sensor to make a prediction:")
  24. # Define input fields
  25. sensor = st.selectbox("Select Sensor", {"Omaxe NRI City": "62a9920f75c931.62399458", "Royal Court": "5f718c439c7a78.65267835"})
  26. Clock = st.date_input("Select Date", value=datetime.date.today())
  27. # Create a feature list
  28. feature_list = [
  29. Clock, sensor
  30. ]
  31. features = np.array(feature_list).reshape(1, -1)
  32. if st.button("Predict"):
  33. obj = PredictionPipeline()
  34. predict = obj.predict(features)
  35. st.success(f"Prediction: {predict}")
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...