File size: 2,068 Bytes
1d9cf6d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import gradio as gr
import random

def predict_maintenance(equipment, hours, vibration, temp):
    risk_score = round(random.uniform(10, 95), 1)
    days_until = random.randint(5, 120)
    confidence = round(random.uniform(75, 98), 1)
    
    if risk_score > 70:
        status = "⚠️ High Risk"
        color = "red"
    elif risk_score > 40:
        status = "🟡 Medium Risk"
        color = "orange"
    else:
        status = "✅ Low Risk"
        color = "green"
    
    result = f"""## {status}

**Equipment**: {equipment}  
**Operating Hours**: {hours}  
**Vibration Level**: {vibration}  
**Temperature**: {temp}°C

### Predictive Analysis
- **Failure Risk Score**: {risk_score}%
- **Estimated Days Until Maintenance**: {days_until} days
- **Prediction Confidence**: {confidence}%

**Recommendation**: {'Schedule immediate inspection' if risk_score > 70 else 'Monitor regularly' if risk_score > 40 else 'Continue normal operations'}

---
**Anktechsol** - Predictive Maintenance AI  
🔗 [Learn more](https://anktechsol.com)"""
    return result

with gr.Blocks(title="Predictive Maintenance") as demo:
    gr.Markdown("# 🔧 AI-Powered Predictive Maintenance")
    gr.Markdown("Industrial equipment failure prediction - **Anktechsol**")
    
    with gr.Row():
        with gr.Column():
            equipment = gr.Dropdown(["Motor A1", "Pump B2", "Compressor C3", "Conveyor D4"], label="Equipment", value="Motor A1")
            hours = gr.Slider(0, 10000, value=5000, label="Operating Hours")
            vibration = gr.Slider(0, 100, value=45, label="Vibration Level (mm/s)")
            temp = gr.Slider(20, 100, value=65, label="Temperature (°C)")
            btn = gr.Button("Predict Maintenance")
        
        with gr.Column():
            output = gr.Markdown()
    
    btn.click(predict_maintenance, inputs=[equipment, hours, vibration, temp], outputs=output)
    
    gr.Markdown("""---
### Anktechsol - Predictive Maintenance Experts
AI-driven industrial maintenance solutions. [Contact us](https://anktechsol.com)""")

demo.launch()