wangli commited on
Commit
3ae2391
1 Parent(s): f489450
Files changed (3) hide show
  1. .gitignore +1 -0
  2. app.py +15 -0
  3. requirements.txt +2 -0
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ .idea/
app.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ pipeline = pipeline(task="image-classification", model="microsoft/resnet-50")
5
+
6
+ def predict(image):
7
+ predictions = pipeline(image)
8
+ return {p["label"]: p["score"] for p in predictions}
9
+
10
+ gr.Interface(
11
+ predict,
12
+ inputs=gr.inputs.Image(label="Upload hot dog candidate", type="filepath"),
13
+ outputs=gr.outputs.Label(num_top_classes=5),
14
+ title="Image Classification",
15
+ ).launch()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ transformers
2
+ torch