Demoapp / app.py
LEGENDCODER1's picture
Create app.py
b02261d verified
raw
history blame
651 Bytes
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()