INNER CODE UNIT · Python

predict

maxpumperla/learning_ray · notebooks/gradio_demo.py:41

def predict(payload):
    payload = np.array(payload, dtype=np.float32)
    array = payload.reshape((1, 3, 32, 32))
    return np.argmax(predictor.predict(array))


demo = gr.Interface(
    fn=predict,
    inputs=gr.Image(),
    outputs=gr.Label(num_top_classes=10)
)

# To just run the Gradio demo, without Serve, simply uncomment the line below
# and start the script with `python gradio_demo.py`:
# demo.launch()

app = GradioServer.options(
    num_replicas=2,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…