Spaces:
Sleeping
Sleeping
File size: 651 Bytes
b02261d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
from transformers import pipeline
import gradio as gr
# Step 1: Load a pre-trained model for image classification
model = pipeline("image-classification", model="google/vit-base-patch16-224")
# Step 2: Define a function for classifying images
def classify_image(image):
predictions = model(image)
return predictions
# Step 3: Create a Gradio interface
interface = gr.Interface(
fn=classify_image,
inputs="image", # Input is an image
outputs="label", # Output is a label (e.g., "sitting", "standing")
title="Pose Detection: Sitting or Standing"
)
# Step 4: Launch the app
if __name__ == "__main__":
interface.launch()
|