File size: 1,176 Bytes
cf49c4b
 
 
801ca00
cf49c4b
 
 
 
 
 
801ca00
a1ff6d2
cf49c4b
 
5d7c9cd
cf49c4b
801ca00
313d70a
 
 
 
 
2997b62
 
313d70a
c3f5319
cf49c4b
b3fa9dd
e02c7a0
 
 
313d70a
c3f5319
313d70a
b3fa9dd
c3f5319
 
 
 
e02c7a0
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import torch
import os
import random
import gradio as gr
from transformers import pipeline
import base64
from datasets import load_dataset
from diffusers import DiffusionPipeline
from huggingface_hub import login
import numpy as np

def guessanImage(model, image):
    imgclassifier  = pipeline("image-classification", model=model)
    if image is not None:  
        description = imgclassifier(image)
    return description

def guessanAge(model, picture):
    imgclassifier  = pipeline("image-classification", model=model)
    if image is not None:  
        description = imgclassifier(image)
    return description    


radio1 = gr.Radio(["microsoft/resnet-50", "google/vit-base-patch16-224", "apple/mobilevit-small"], label="Select a Classifier", info="Image Classifier")
tab1 = gr.Interface(
    fn=guessanImage,
    inputs=[radio1, gr.Image(type="pil")],
    outputs=["text"],
)

radio2 = gr.Radio(["nateraw/vit-age-classifier"], label="Select an Age Classifier", info="Age Classifier")
tab2 = gr.Interface(
    fn=guessanAge,
    inputs=[radio2, gr.Image(type="pil")],
    outputs=["text"],
)

demo = gr.TabbedInterface([tab1, tab2], ["tab1", "tab2"])
demo.launch()