Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import random
|
| 3 |
+
|
| 4 |
+
# Function to simulate the prediction
|
| 5 |
+
def predict_equipment_usage(hours_used):
|
| 6 |
+
# Example logic: Predict 'Repair' if usage is greater than 8 hours
|
| 7 |
+
prediction = "Repair" if hours_used > 8 else "Normal"
|
| 8 |
+
confidence = random.uniform(0.7, 1.0) # Random confidence
|
| 9 |
+
return prediction, confidence
|
| 10 |
+
|
| 11 |
+
# Create the Gradio interface
|
| 12 |
+
iface = gr.Interface(
|
| 13 |
+
fn=predict_equipment_usage,
|
| 14 |
+
inputs="number", # Input is a number (hours used)
|
| 15 |
+
outputs=["text", "number"], # Output is prediction (text) and confidence (number)
|
| 16 |
+
live=True, # Makes it responsive
|
| 17 |
+
title="Equipment Usage Prediction"
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
iface.launch()
|