snayan06 commited on
Commit
48fd91d
1 Parent(s): 673af9e

making hot-dog or not sample app

Browse files
Files changed (2) hide show
  1. app.py +12 -4
  2. requirements.txt +80 -0
app.py CHANGED
@@ -1,9 +1,17 @@
1
  import gradio as gr
 
2
 
 
3
 
4
- def greet(name):
5
- return "Hello " + name + "!!"
6
 
 
 
 
7
 
8
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
9
- iface.launch()
 
 
 
 
 
 
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
 
7
+ def predict(image):
8
+ predictions = pipeline(image)
9
+ return {p["label"]: p["score"] for p in predictions}
10
 
11
+
12
+ gr.Interface(
13
+ 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()
requirements.txt ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ anyio==3.3.2
2
+ appnope==0.1.2
3
+ argon2-cffi==21.1.0
4
+ async-generator==1.10
5
+ attrs==21.2.0
6
+ Babel==2.9.1
7
+ backcall==0.2.0
8
+ bleach==4.1.0
9
+ certifi==2021.5.30
10
+ cffi==1.14.6
11
+ charset-normalizer==2.0.6
12
+ contextvars==2.4
13
+ cycler==0.10.0
14
+ dataclasses==0.8
15
+ decorator==5.1.0
16
+ defusedxml==0.7.1
17
+ dnspython==2.1.0
18
+ entrypoints==0.3
19
+ idna==3.2
20
+ immutables==0.16
21
+ importlib-metadata==4.8.1
22
+ ipykernel==5.5.5
23
+ ipython==7.16.1
24
+ ipython-genutils==0.2.0
25
+ jedi==0.18.0
26
+ Jinja2==3.0.1
27
+ json5==0.9.6
28
+ jsonschema==3.2.0
29
+ jupyter-client==7.0.4
30
+ jupyter-core==4.8.1
31
+ jupyter-server==1.11.0
32
+ jupyterlab-pygments==0.1.2
33
+ jupyterlab-server==2.8.2
34
+ kiwisolver==1.3.1
35
+ MarkupSafe==2.0.1
36
+ matplotlib==3.3.4
37
+ mistune==0.8.4
38
+ nbclassic==0.3.2
39
+ nbclient==0.5.4
40
+ nbconvert==6.0.7
41
+ nbformat==5.1.3
42
+ nest-asyncio==1.5.1
43
+ notebook==6.4.4
44
+ numpy==1.19.5
45
+ packaging==21.0
46
+ pandocfilters==1.5.0
47
+ parso==0.8.2
48
+ pexpect==4.8.0
49
+ pickleshare==0.7.5
50
+ Pillow==8.3.2
51
+ pip-autoremove==0.10.0
52
+ prometheus-client==0.11.0
53
+ prompt-toolkit==3.0.20
54
+ ptyprocess==0.7.0
55
+ pycparser==2.20
56
+ Pygments==2.10.0
57
+ PyMySQL==1.0.2
58
+ pyparsing==2.4.7
59
+ pyrsistent==0.18.0
60
+ python-dateutil==2.8.2
61
+ pytz==2021.1
62
+ PyYAML==5.4.1
63
+ pyzmq==22.3.0
64
+ requests==2.26.0
65
+ requests-unixsocket==0.2.0
66
+ Send2Trash==1.8.0
67
+ six==1.16.0
68
+ sniffio==1.2.0
69
+ terminado==0.12.1
70
+ testpath==0.5.0
71
+ tornado==6.1
72
+ traitlets==4.3.3
73
+ typing-extensions==3.10.0.2
74
+ urllib3==1.26.7
75
+ wcwidth==0.2.5
76
+ webencodings==0.5.1
77
+ websocket-client==1.2.1
78
+ zipp==3.5.1
79
+ transformers
80
+ torch