Spaces:
Sleeping
Sleeping
# Example app.py for a TensorFlow model | |
import tensorflow as tf | |
import numpy as np | |
import gradio as gr | |
# Load your TensorFlow model | |
model = tf.keras.models.load_model('model/model.h5') | |
def predict(input_data): | |
# Preprocess input | |
processed_input = preprocess(input_data) | |
# Make prediction | |
prediction = model.predict(processed_input) | |
# Postprocess prediction | |
return postprocess(prediction) | |
# Create Gradio interface | |
iface = gr.Interface( | |
fn=predict, | |
inputs=gr.Textbox(label="Your Input"), | |
outputs=gr.Textbox(label="Prediction") | |
) | |
if __name__ == "__main__": | |
iface.launch() |