File size: 553 Bytes
fe07070
 
 
 
 
 
 
 
0973397
fe07070
 
 
 
0973397
fe07070
 
 
12b2e88
c460421
0973397
fe07070
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# import gradio as gr

# def greet(name):
#     return "Hello " + name + "!!"

# iface = gr.Interface(fn=greet, inputs="text", outputs="text")
# iface.launch()

import gradio as gr
from fastai.vision.all import *
import skimage

learn = load_learner("topmountainsmodel.pkl")

def predict(img):
    img = PILImage.create(img)
    mt_type,_,probs = learn.predict(img)
    message = (f"Probability that this mountain is: {mt_type} is {probs[0]:.4f}")
    return message

iface = gr.Interface(fn=predict, inputs="image", outputs="label")
iface.launch()