santhakumar
commited on
Commit
•
150486c
1
Parent(s):
7c2e0b1
Added Hot Dog Demo Project
Browse files
App.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
|
5 |
+
|
6 |
+
print("it is working")
|
7 |
+
print("that is super exiciting")
|
8 |
+
|
9 |
+
def predict(image):
|
10 |
+
predictions = pipeline(image)
|
11 |
+
return {p["label"]:p["score"] for p in predictions}
|
12 |
+
|
13 |
+
gr.Interface(predict,
|
14 |
+
inputs=gr.inputs.Image(label="Upload hot dog candidate", type="filepath"),
|
15 |
+
outputs=gr.outputs.Label(num_top_classes=2),
|
16 |
+
title="Hot Dog? Or Not?",
|
17 |
+
).launch()
|
18 |
+
|
19 |
+
|
20 |
+
def greet(name):
|
21 |
+
return "Hello " + name + "!"
|
22 |
+
|
23 |
+
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
24 |
+
|
25 |
+
if __name__ == "__main__":
|
26 |
+
demo.launch()
|
flagged/Upload hot dog candidate/fdf3d49cc1e36299d924079acf6242fb821357b1/tmpxz6qs6ro.jpg
ADDED
flagged/log.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
Upload hot dog candidate,output,flag,username,timestamp
|
2 |
+
C:\hotdog\flagged\Upload hot dog candidate\fdf3d49cc1e36299d924079acf6242fb821357b1\tmpxz6qs6ro.jpg,C:\hotdog\flagged\output\tmpa5n3d7fr.json,,,2023-06-23 22:56:24.825695
|
flagged/output/tmpa5n3d7fr.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"label": "hot dog", "confidences": [{"label": "hot dog", "confidence": 0.6445047855377197}, {"label": "not hot dog", "confidence": 0.3554952144622803}]}
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
transformers
|
2 |
+
torch
|