-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
24 lines (20 loc) · 812 Bytes
/
app.py
File metadata and controls
24 lines (20 loc) · 812 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
import gradio as gr
import PIL
from inference import inference_model, predict_image_class
def predict(adaptor, image):
if not image or not adaptor:
return "Check whether you have selected classification type or uploaded image"
model, image_processor = inference_model(adaptor)
return predict_image_class(image, model, image_processor)
if __name__ == "__main__":
app = gr.Interface(
fn = predict,
inputs=[
gr.Dropdown(choices=['Food', 'Human Actions'], label="Classification Type"),
gr.Image(type='pil', label="Upload Image")
],
outputs=gr.Textbox(label="Predicted Class"),
title="LoRA Adaptor based Classification",
description="Choose a LoRA adaptor for particular type of classification"
)
app.launch()