Assignment 10
Assignment 10
[ ]: # app.py
from flask import Flask, request, jsonify
import tensorflow as tf
import numpy as np
from PIL import Image
import io
# Perform prediction
prediction = model.predict(image_array)
predicted_class = np.argmax(prediction, axis=1)[0]
confidence = prediction[0][predicted_class]
1
"predicted_class": int(predicted_class),
"confidence": float(confidence)
})
WARNING:absl:Compiled the loaded model, but the compiled metrics have yet to be
built. `model.compile_metrics` will be empty until you train or evaluate the
model.
* Serving Flask app '__main__'
* Debug mode: off
INFO:werkzeug:WARNING: This is a development server. Do not use it in a
production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:5000
* Running on http://192.168.0.107:5000
INFO:werkzeug:Press CTRL+C to quit
INFO:werkzeug:192.168.0.107 - - [01/Nov/2024 21:48:49] "GET / HTTP/1.1"
404 -
INFO:werkzeug:192.168.0.107 - - [01/Nov/2024 21:48:50] "GET /favicon.ico
HTTP/1.1" 404 -
INFO:werkzeug:127.0.0.1 - - [01/Nov/2024 21:48:54] "GET / HTTP/1.1" 404
-
INFO:werkzeug:127.0.0.1 - - [01/Nov/2024 21:48:54] "GET /favicon.ico
HTTP/1.1" 404 -