-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
27 lines (18 loc) · 651 Bytes
/
Copy pathmain.py
File metadata and controls
27 lines (18 loc) · 651 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import gradio as gr
from load_model import PrePro
# Create an instance of PrePro class
prs = PrePro()
# Define the function for the image classifier
def image_classifier(inp):
# Preprocess the input image
img = prs.preprocess(inp)
# Get the prediction from the model
out = prs.predict(img)
# Get the probabilities and labels for the top predictions
results = prs.probability(out)
# Return the results
return results
# Create a Gradio interface with the image classifier function
demo = gr.Interface(fn=image_classifier, inputs="image", outputs="label")
# Launch the Gradio interface
demo.launch()