File size: 820 Bytes
581834c
 
 
 
61bf9ed
 
 
 
 
 
 
 
 
 
581834c
 
61bf9ed
581834c
61bf9ed
 
 
 
581834c
 
 
 
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
import gradio as gr
import random

# Function to simulate the prediction
def predict_equipment_usage(hours_used, idle_hours):
    # Example logic based on hours of usage and idle time
    if hours_used > 8 and idle_hours > 2:
        prediction = "Repair"
    elif hours_used > 6 and idle_hours < 2:
        prediction = "Move"
    else:
        prediction = "Normal"
    
    confidence = random.uniform(0.7, 1.0)  # Random confidence value for now
    return prediction, confidence

# Create the Gradio interface with inputs: hours used and idle hours
iface = gr.Interface(
    fn=predict_equipment_usage,
    inputs=["number", "number"],  # Inputs: hours used and idle hours
    outputs=["text", "number"],  # Outputs: prediction and confidence
    live=True,
    title="Equipment Usage Prediction"
)

iface.launch()