popcorn / app.py
VaneshDev's picture
Update app.py
61bf9ed verified
raw
history blame contribute delete
820 Bytes
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()