Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,27 +10,28 @@ from huggingface_hub import login
|
|
| 10 |
import numpy as np
|
| 11 |
|
| 12 |
def guessanImage(model, image):
|
| 13 |
-
#model = "microsoft/resnet-50"
|
| 14 |
-
# st.write("using model:"+model)
|
| 15 |
-
|
| 16 |
imgclassifier = pipeline("image-classification", model=model)
|
| 17 |
if image is not None:
|
| 18 |
description = imgclassifier(image)
|
| 19 |
return description
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
|
| 23 |
-
|
| 24 |
-
radio1 = gr.Radio(["microsoft/resnet-50", "google/vit-base-patch16-224", "apple/mobilevit-small"], label="Select a Classifier", info="Image Classifier?")
|
| 25 |
tab1 = gr.Interface(
|
| 26 |
fn=guessanImage,
|
| 27 |
inputs=[radio1, gr.Image(type="pil")],
|
| 28 |
outputs=["text"],
|
| 29 |
)
|
| 30 |
|
| 31 |
-
radio2 = gr.Radio(["
|
| 32 |
tab2 = gr.Interface(
|
| 33 |
-
fn=
|
| 34 |
inputs=[radio2, gr.Image(type="pil")],
|
| 35 |
outputs=["text"],
|
| 36 |
)
|
|
|
|
| 10 |
import numpy as np
|
| 11 |
|
| 12 |
def guessanImage(model, image):
|
|
|
|
|
|
|
|
|
|
| 13 |
imgclassifier = pipeline("image-classification", model=model)
|
| 14 |
if image is not None:
|
| 15 |
description = imgclassifier(image)
|
| 16 |
return description
|
| 17 |
|
| 18 |
+
def guessanAge(model, picture):
|
| 19 |
+
imgclassifier = pipeline("image-classification", model=model)
|
| 20 |
+
if image is not None:
|
| 21 |
+
description = imgclassifier(image)
|
| 22 |
+
return description
|
| 23 |
|
| 24 |
|
| 25 |
+
radio1 = gr.Radio(["microsoft/resnet-50", "google/vit-base-patch16-224", "apple/mobilevit-small"], label="Select a Classifier", info="Image Classifier")
|
|
|
|
| 26 |
tab1 = gr.Interface(
|
| 27 |
fn=guessanImage,
|
| 28 |
inputs=[radio1, gr.Image(type="pil")],
|
| 29 |
outputs=["text"],
|
| 30 |
)
|
| 31 |
|
| 32 |
+
radio2 = gr.Radio(["nateraw/vit-age-classifier"], label="Select an Age Classifier", info="Age Classifier")
|
| 33 |
tab2 = gr.Interface(
|
| 34 |
+
fn=guessanAge,
|
| 35 |
inputs=[radio2, gr.Image(type="pil")],
|
| 36 |
outputs=["text"],
|
| 37 |
)
|