modelito1 / app.py
gusdelact's picture
Creado app.py
4250e41 verified
raw
history blame
806 Bytes
import gradio as gr
import tensorflow as tf
# Cargar el modelo
model = tf.keras.models.load_model('modelito1.h5')
model.summary()
def inferir(x_entrada):
x_train_min = -100
x_train_max = 96
y_train_min = -90.0
y_train_max = 106
x_entrada_normalizado = (x_entrada - x_train_min) / (x_train_max - x_train_min)
X0 = tf.constant([x_entrada_normalizado], dtype=tf.float32)
# Realizar la inferencia
y0_predicted = model.predict(X0)
y0_normalized = y0_predicted[0][0]
y0 = y0_normalized * (y_train_max - y_train_min) + y_train_min
return y0
iface = gr.Interface(
fn=inferir,
inputs=gr.Number(label="Entrada"),
outputs="number",
title="Inferencia del Modelo",
description="Introduce un valor para realizar la inferencia con el modelo modelito1.h5"
)
iface.launch()