ursgehrig commited on
Commit
4a4e8e6
·
verified ·
1 Parent(s): 28f3ce3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -1
app.py CHANGED
@@ -11,6 +11,30 @@ st.title('PantoScanner')
11
  st.header('Example')
12
  st.subheader('Thickness measurement of sliding element')
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  tab1, tab2, tab3 = st.tabs([f' {image_emoji} Image', f' {model_emoji} Mask', f' {profile_emoji} Measurement'])
15
 
16
  with tab1:
@@ -24,7 +48,15 @@ with tab2:
24
 
25
  with tab3:
26
  st.header(f'Profile Height')
27
- data = np.random.randn(10, 1)
 
 
 
 
 
 
 
 
28
  st.line_chart(data)
29
 
30
 
 
11
  st.header('Example')
12
  st.subheader('Thickness measurement of sliding element')
13
 
14
+ import numpy as np
15
+
16
+ def generate_data(slope, intercept, num_points):
17
+ """
18
+ Generates data points with a linear degression and a +/- 5% tolerance.
19
+
20
+ Args:
21
+ slope: The slope of the linear degression.
22
+ intercept: The y-intercept of the linear degression.
23
+ num_points: The number of data points to generate.
24
+
25
+ Returns:
26
+ A numpy array of size (num_points, 1) containing the data points.
27
+ """
28
+ x = np.linspace(0, 1, num_points) # Creates evenly spaced x-values
29
+ y = slope * x + intercept # Generates linear function values
30
+
31
+ # Add random noise with +/- 5% tolerance
32
+ noise = np.random.uniform(low=-0.05, high=0.05, size=num_points)
33
+ y += noise * y # Scale noise by original y value for percentage variation
34
+
35
+ return y.reshape(-1, 1) # Reshape to column vector
36
+
37
+
38
  tab1, tab2, tab3 = st.tabs([f' {image_emoji} Image', f' {model_emoji} Mask', f' {profile_emoji} Measurement'])
39
 
40
  with tab1:
 
48
 
49
  with tab3:
50
  st.header(f'Profile Height')
51
+ # data = np.random.randn(10, 1)
52
+ # Example usage
53
+ # Use 'data' for your chart with linear degression and +/- 5% tolerance
54
+
55
+ slope = -2 # Example slope for linear degression
56
+ intercept = 10
57
+ num_points = 20
58
+
59
+ data = generate_data(slope, intercept, num_points)
60
  st.line_chart(data)
61
 
62