Update app.py
Browse files
app.py
CHANGED
|
@@ -2,18 +2,24 @@ import gradio as gr
|
|
| 2 |
import random
|
| 3 |
|
| 4 |
# Function to simulate the prediction
|
| 5 |
-
def predict_equipment_usage(hours_used):
|
| 6 |
-
# Example logic
|
| 7 |
-
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
return prediction, confidence
|
| 10 |
|
| 11 |
-
# Create the Gradio interface
|
| 12 |
iface = gr.Interface(
|
| 13 |
-
fn=predict_equipment_usage,
|
| 14 |
-
inputs="number", #
|
| 15 |
-
outputs=["text", "number"], #
|
| 16 |
-
live=True,
|
| 17 |
title="Equipment Usage Prediction"
|
| 18 |
)
|
| 19 |
|
|
|
|
| 2 |
import random
|
| 3 |
|
| 4 |
# Function to simulate the prediction
|
| 5 |
+
def predict_equipment_usage(hours_used, idle_hours):
|
| 6 |
+
# Example logic based on hours of usage and idle time
|
| 7 |
+
if hours_used > 8 and idle_hours > 2:
|
| 8 |
+
prediction = "Repair"
|
| 9 |
+
elif hours_used > 6 and idle_hours < 2:
|
| 10 |
+
prediction = "Move"
|
| 11 |
+
else:
|
| 12 |
+
prediction = "Normal"
|
| 13 |
+
|
| 14 |
+
confidence = random.uniform(0.7, 1.0) # Random confidence value for now
|
| 15 |
return prediction, confidence
|
| 16 |
|
| 17 |
+
# Create the Gradio interface with inputs: hours used and idle hours
|
| 18 |
iface = gr.Interface(
|
| 19 |
+
fn=predict_equipment_usage,
|
| 20 |
+
inputs=["number", "number"], # Inputs: hours used and idle hours
|
| 21 |
+
outputs=["text", "number"], # Outputs: prediction and confidence
|
| 22 |
+
live=True,
|
| 23 |
title="Equipment Usage Prediction"
|
| 24 |
)
|
| 25 |
|