Spaces:
Runtime error
Runtime error
| 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() | |