Spaces:
No application file
No application file
Final Project
Browse filesFiles changed (2)
- app.py+19-5
- inception.h5Added+3
11342345678910111213141516171819206721import gradio as gr
def greet(name): return "Hello " + name + "!!"import tensorflowfrom tensorflow import kerasfrom keras.models import load_modelmodel1 = load_model("inception.h5")
img_width, img_height = 180, 180class_names = ['daisy', 'dandelion', 'roses', 'sunflowers', 'tulips']num_classes = len(class_names)
def predict_image(img): img_4d = img.reshape(-1, img_width, img_height, 3) # 4D coz model trained on multiple 3Ds prediction = model1.predict(img_4d)[0] return {class_names[i]: float(prediction[i]) for i in range(num_classes)}
import gradio as grimage = gr.inputs.Image(shape=(img_height, img_width))label = gr.outputs.Label(num_top_classes=num_classes)
iface = gr.Interface(fn=greet, inputs="text", outputs="text")iface.launch()gr.Interface(fn=predict_image, inputs=image, outputs=label, title="Flower Classification using InceptionV3", interpretation='default').launch(debug='True', share='True')123version https://git-lfs.github.com/spec/v1oid sha256:d75cab7598d7b20a3c1e8c2a53b5b87dd60fc71c2ebbdb7f8fda7767ac46981esize 94556992app.py+19-5
inception.h5Added+3