LEGENDCODER1 commited on
Commit
6fef29a
·
verified ·
1 Parent(s): 191a1d7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -6
app.py CHANGED
@@ -1,9 +1,22 @@
1
- import streamlit as st
2
  from transformers import pipeline
 
3
 
4
- pipe = pipeline('sentiment-analysis')
5
- text = st.text_area('enter some text!')
6
 
7
- if text:
8
- out = pipe(text)
9
- st.json(out)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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()