Mohuu0601 commited on
Commit
6bf59e6
·
verified ·
1 Parent(s): 9336c0a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -1,7 +1,8 @@
 
1
  !pip install transformers
2
  !pip install streamlit
3
  !pip install torch
4
- !pip install transformers torch datasets gradio
5
 
6
  import gradio as gr
7
  from transformers import pipeline
@@ -18,11 +19,11 @@ def classify_image(image):
18
  interface = gr.Interface(
19
  fn=classify_image,
20
  inputs=gr.Image(type="pil"),
21
- outputs=gr.Label(),
22
  title="Image Classification App",
23
  description="Upload an image, and the app will classify it using a Vision Transformer (ViT) model."
24
  )
25
 
26
  # Launch the app
27
- if _name_ == "_main_":
28
- interface.launch()
 
1
+ # Install required packages
2
  !pip install transformers
3
  !pip install streamlit
4
  !pip install torch
5
+ !pip install datasets gradio
6
 
7
  import gradio as gr
8
  from transformers import pipeline
 
19
  interface = gr.Interface(
20
  fn=classify_image,
21
  inputs=gr.Image(type="pil"),
22
+ outputs=gr.JSON(), # Updated to JSON for dictionary-like output
23
  title="Image Classification App",
24
  description="Upload an image, and the app will classify it using a Vision Transformer (ViT) model."
25
  )
26
 
27
  # Launch the app
28
+ if __name__ == "__main__":
29
+ interface.launch()