| 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() |