LEGENDCODER1 commited on
Commit
b02261d
·
verified ·
1 Parent(s): 7656eb8

Create app.py

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