VaneshDev commited on
Commit
61bf9ed
·
verified ·
1 Parent(s): 581834c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -9
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: 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
 
 
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