# -*- coding: utf-8 -*-
"""Biome_Classifier_4.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/18IX5V6Qgf-WhhfFRvT9KZZXu5_dCs4pT
"""
from google.colab import drive
drive.mount('/content/drive')
# Commented out IPython magic to ensure Python compatibility.
# #hide
# %%capture
# ! [ -e /content ] && pip install -Uqq fastbook
# ! pip install gradio==3.50
# ! pip install nbdev
#
# import fastbook
# fastbook.setup_book
#hide
from fastbook import *
from fastai.vision.widgets import *
import skimage
gpath = '/content/drive/MyDrive/'
learn = load_learner(gpath +'/BiomeClassifierModel.pkl')
labels = learn.dls.vocab
def predict(img):
img = PILImage.create(img)
pred,pred_idx,probs = learn.predict(img)
return {labels[i]: float(probs[i]) for i in range(len(labels))}
import gradio as gr
title = "Biome Classifier"
description = "World's first biome classifier powered by Artificial Intelligence
This neural network analyzes any nature photo and identifies what type of biome it depicts
Feel free to upload your own photo or try some examples below
Written by David Willis"
article="