Spaces:
Runtime error
Runtime error
Update app.py
Browse files3 unmodified lines4567891012 unmodified lines23242526272829303132333435363 unmodified linesfrom PIL import Imagemodel_path = "DogClassifier.keras"model = tf.keras.models.load_model(model_path)# Define the core prediction function12 unmodified linesprediction = tf.nn.softmax(prediction)# Create a dictionary with the probabilities for each PokemonborderCollie = np.round(float(prediction[0][0]), 2)corgi = np.round(float(prediction[0][1]), 2)germanShepard = np.round(float(prediction[0][2]), 2)goldenRetriever = np.round(float(prediction[0][3]), 2)pitBull = np.round(float(prediction[0][4]), 2)rottweiler = np.round(float(prediction[0][4]), 2)return {'Border Collie': borderCollie, 'Corgi': corgi, 'German Shepard': germanShepard, 'Golder Retriver': goldenRetriever, 'Pit Bull': pitBull, 'Rottweiler': rottweiler}input_image = gr.Image()3 unmodified lines4567891012 unmodified lines2324252627282930313233343536373839404142434445464748495051525354555657585960616263646566673 unmodified linesfrom PIL import Imagemodel_path = "DogClassifierComplex.keras"model = tf.keras.models.load_model(model_path)# Define the core prediction function12 unmodified linesprediction = tf.nn.softmax(prediction)# Create a dictionary with the probabilities for each Pokemonafghan = np.round(float(prediction[0][0]), 2)africanWildDog = np.round(float(prediction[0][1]), 2)beagle = np.round(float(prediction[0][2]), 2)blenheim = np.round(float(prediction[0][3]), 2)borderColie = np.round(float(prediction[0][4]), 2)bostonTerrier = np.round(float(prediction[0][5]), 2)chineseCrested = np.round(float(prediction[0][6]), 2)cocker = np.round(float(prediction[0][7]), 2)corgi = np.round(float(prediction[0][8]), 2)dingo = np.round(float(prediction[0][9]), 2)frenchBulldog = np.round(float(prediction[0][10]), 2)germanShepard = np.round(float(prediction[0][11]), 2)goldenRetriever = np.round(float(prediction[0][12]), 2)pitBull = np.round(float(prediction[0][13]), 2)rottweiler = np.round(float(prediction[0][14]), 2)irishSpaniel = np.round(float(prediction[0][15]), 2)labrador = np.round(float(prediction[0][16]), 2)maltese = np.round(float(prediction[0][17]), 2)newfoundland = np.round(float(prediction[0][18]), 2)pomeranian = np.round(float(prediction[0][19]), 2)poodle = np.round(float(prediction[0][20]), 2)rhodesian = np.round(float(prediction[0][21]), 2)saintBernard = np.round(float(prediction[0][22]), 2)schnauzer = np.round(float(prediction[0][23]), 2)scotchTerrier = np.round(float(prediction[0][24]), 2)sharPei = np.round(float(prediction[0][25]), 2)shibaInu = np.round(float(prediction[0][26]), 2)siberianHusky = np.round(float(prediction[0][27]), 2)yorkie = np.round(float(prediction[0][28]), 2)return {'Afghan': afghan, 'African Wild Dog': africanWildDog, 'Beagle': beagle, 'Blenheim': blenheim,'Border Collie': borderColie, 'Boston Terrier': bostonTerrier, 'Chinese Crested': chineseCrested, 'Cocker': cocker,'Corgi': corgi, 'Dingo': dingo, 'French Bulldog': frenchBulldog, 'German Shepard': germanShepard,'GoldenRetriever': goldenRetriever, 'Pit Bull': pitBull, 'Rottweiler': rottweiler, 'Irish Spaniel': irishSpaniel,'Labrador': labrador, 'Maltese': maltese, 'Newfoundland': newfoundland, 'Pomeranian': pomeranian,'Poodle': poodle, 'Rhodesian': rhodesian, 'Saint Bernard': saintBernard, 'Schnauzer': schnauzer,'Scotch Terrier': scotchTerrier, 'Shar Pei': sharPei, 'Shiba Inu': shibaInu, 'Siberian Husky': siberianHusky,'Yorkie': yorkie}input_image = gr.Image()
app.py+39-8