DOMMETI commited on
Commit
190accd
·
verified ·
1 Parent(s): 741b7dd

Update Home.py

Browse files
Files changed (1) hide show
  1. Home.py +6 -7
Home.py CHANGED
@@ -4,10 +4,9 @@ from keras.models import load_model
4
  import numpy as np
5
  import cv2
6
 
7
- # --- Page Config ---
8
  st.set_page_config(page_title="Digit AI", layout="centered")
9
 
10
- # --- Custom UI Styling ---
11
  st.markdown("""
12
  <style>
13
  @import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@500&family=Outfit:wght@300;400;600&display=swap');
@@ -65,11 +64,11 @@ p {
65
  </style>
66
  """, unsafe_allow_html=True)
67
 
68
- # --- Title + Description ---
69
  st.markdown("<h1>Digit Recognizer</h1>", unsafe_allow_html=True)
70
  st.markdown("<p>Draw a digit (0–9) below and see what the AI thinks it is!</p>", unsafe_allow_html=True)
71
 
72
- # --- Sidebar Settings ---
73
  st.sidebar.markdown("### ✏️ Drawing Settings")
74
  drawing_mode = st.sidebar.selectbox("Tool", ("freedraw", "line", "rect", "circle", "transform"))
75
  stroke_width = st.sidebar.slider("Stroke Width", 1, 25, 10)
@@ -77,14 +76,14 @@ stroke_color = st.sidebar.color_picker("Stroke Color", "#FFFFFF")
77
  bg_color = st.sidebar.color_picker("Background Color", "#000000")
78
  realtime_update = st.sidebar.checkbox("Update Realtime", True)
79
 
80
- # --- Load Model ---
81
  @st.cache_resource
82
  def load_mnist_model():
83
  return load_model("digit_recognization.keras")
84
 
85
  model = load_mnist_model()
86
 
87
- # --- Canvas Drawing Area ---
88
  st.markdown('<div class="canvas-wrapper">', unsafe_allow_html=True)
89
  canvas_result = st_canvas(
90
  fill_color="rgba(255, 255, 255, 0.05)",
@@ -99,7 +98,7 @@ canvas_result = st_canvas(
99
  )
100
  st.markdown('</div>', unsafe_allow_html=True)
101
 
102
- # --- Prediction Display ---
103
  if canvas_result.image_data is not None:
104
  img = cv2.cvtColor(canvas_result.image_data.astype("uint8"), cv2.COLOR_RGBA2GRAY)
105
  img_resized = cv2.resize(img, (28, 28))
 
4
  import numpy as np
5
  import cv2
6
 
7
+
8
  st.set_page_config(page_title="Digit AI", layout="centered")
9
 
 
10
  st.markdown("""
11
  <style>
12
  @import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@500&family=Outfit:wght@300;400;600&display=swap');
 
64
  </style>
65
  """, unsafe_allow_html=True)
66
 
67
+
68
  st.markdown("<h1>Digit Recognizer</h1>", unsafe_allow_html=True)
69
  st.markdown("<p>Draw a digit (0–9) below and see what the AI thinks it is!</p>", unsafe_allow_html=True)
70
 
71
+
72
  st.sidebar.markdown("### ✏️ Drawing Settings")
73
  drawing_mode = st.sidebar.selectbox("Tool", ("freedraw", "line", "rect", "circle", "transform"))
74
  stroke_width = st.sidebar.slider("Stroke Width", 1, 25, 10)
 
76
  bg_color = st.sidebar.color_picker("Background Color", "#000000")
77
  realtime_update = st.sidebar.checkbox("Update Realtime", True)
78
 
79
+
80
  @st.cache_resource
81
  def load_mnist_model():
82
  return load_model("digit_recognization.keras")
83
 
84
  model = load_mnist_model()
85
 
86
+
87
  st.markdown('<div class="canvas-wrapper">', unsafe_allow_html=True)
88
  canvas_result = st_canvas(
89
  fill_color="rgba(255, 255, 255, 0.05)",
 
98
  )
99
  st.markdown('</div>', unsafe_allow_html=True)
100
 
101
+
102
  if canvas_result.image_data is not None:
103
  img = cv2.cvtColor(canvas_result.image_data.astype("uint8"), cv2.COLOR_RGBA2GRAY)
104
  img_resized = cv2.resize(img, (28, 28))