anktechsol commited on
Commit
1d9cf6d
·
verified ·
1 Parent(s): fd62671

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +59 -0
app.py ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import random
3
+
4
+ def predict_maintenance(equipment, hours, vibration, temp):
5
+ risk_score = round(random.uniform(10, 95), 1)
6
+ days_until = random.randint(5, 120)
7
+ confidence = round(random.uniform(75, 98), 1)
8
+
9
+ if risk_score > 70:
10
+ status = "⚠️ High Risk"
11
+ color = "red"
12
+ elif risk_score > 40:
13
+ status = "🟡 Medium Risk"
14
+ color = "orange"
15
+ else:
16
+ status = "✅ Low Risk"
17
+ color = "green"
18
+
19
+ result = f"""## {status}
20
+
21
+ **Equipment**: {equipment}
22
+ **Operating Hours**: {hours}
23
+ **Vibration Level**: {vibration}
24
+ **Temperature**: {temp}°C
25
+
26
+ ### Predictive Analysis
27
+ - **Failure Risk Score**: {risk_score}%
28
+ - **Estimated Days Until Maintenance**: {days_until} days
29
+ - **Prediction Confidence**: {confidence}%
30
+
31
+ **Recommendation**: {'Schedule immediate inspection' if risk_score > 70 else 'Monitor regularly' if risk_score > 40 else 'Continue normal operations'}
32
+
33
+ ---
34
+ **Anktechsol** - Predictive Maintenance AI
35
+ 🔗 [Learn more](https://anktechsol.com)"""
36
+ return result
37
+
38
+ with gr.Blocks(title="Predictive Maintenance") as demo:
39
+ gr.Markdown("# 🔧 AI-Powered Predictive Maintenance")
40
+ gr.Markdown("Industrial equipment failure prediction - **Anktechsol**")
41
+
42
+ with gr.Row():
43
+ with gr.Column():
44
+ equipment = gr.Dropdown(["Motor A1", "Pump B2", "Compressor C3", "Conveyor D4"], label="Equipment", value="Motor A1")
45
+ hours = gr.Slider(0, 10000, value=5000, label="Operating Hours")
46
+ vibration = gr.Slider(0, 100, value=45, label="Vibration Level (mm/s)")
47
+ temp = gr.Slider(20, 100, value=65, label="Temperature (°C)")
48
+ btn = gr.Button("Predict Maintenance")
49
+
50
+ with gr.Column():
51
+ output = gr.Markdown()
52
+
53
+ btn.click(predict_maintenance, inputs=[equipment, hours, vibration, temp], outputs=output)
54
+
55
+ gr.Markdown("""---
56
+ ### Anktechsol - Predictive Maintenance Experts
57
+ AI-driven industrial maintenance solutions. [Contact us](https://anktechsol.com)""")
58
+
59
+ demo.launch()