ANN_reg_model / app.py
moh19869's picture
Create app.py
6f965ac
raw
history blame contribute delete
784 Bytes
import gradio as gr
import numpy as np
import tensorflow as tf # Or your preferred library for neural networks
# Load your trained ANN model
# Replace 'model_path' with the path to your saved model
model_path = 'reg_model.h5'
model = tf.keras.models.load_model(model_path)
def predict(num1, num2):
# Preprocess input (if needed)
#input_data = np.array([[num1, num2]]) # Assuming the model expects a 2D array
# Make prediction using the loaded model
prediction = model.predict(scaler.transform([[num1,num2]]))[0]
return {'prediction': prediction}
iface = gr.Interface(
fn=predict,
inputs=[gr.inputs.Number(), gr.inputs.Number()],
outputs="text" # Display the prediction as text
)
# Launch the interface on a specific IP and port
iface.launch()