File size: 814 Bytes
6e0d345
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
28
29
import gradio as gr
from tensorflow.keras.models import load_model
import numpy as np

# Load the saved model
model = load_model('time_prediction_model.h5')

def predict_time(features):
    # Assuming features is a list of input values
    input_data = np.array(features).reshape(1, -1)
    hour_prediction, minute_prediction = model.predict(input_data)
    
    # Convert predictions to readable format
    predicted_hour = np.argmax(hour_prediction)
    predicted_minute = np.argmax(minute_prediction)
    
    return f"{predicted_hour:02}:{predicted_minute:02}"

# Create a Gradio interface
interface = gr.Interface(
    fn=predict_time,
    inputs=[gr.inputs.Textbox(lines=2, placeholder="Enter input features")],
    outputs="text",
    title="Time Prediction AI"
)

# Launch the interface
interface.launch()