nazha-567 commited on
Commit
d420bd7
β€’
1 Parent(s): a75feba

feat: main

Browse files
.ipynb_checkpoints/fineApp-checkpoint.ipynb ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 5,
6
+ "metadata": {},
7
+ "outputs": [
8
+ {
9
+ "ename": "ModuleNotFoundError",
10
+ "evalue": "No module named 'fastbook'",
11
+ "output_type": "error",
12
+ "traceback": [
13
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
14
+ "\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
15
+ "Cell \u001b[0;32mIn[5], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m get_ipython()\u001b[39m.\u001b[39msystem(\u001b[39m'\u001b[39m\u001b[39m[ -e /content ] && pip install -Uqq fastbook\u001b[39m\u001b[39m'\u001b[39m)\n\u001b[0;32m----> 3\u001b[0m \u001b[39mimport\u001b[39;00m \u001b[39mfastbook\u001b[39;00m\n\u001b[1;32m 4\u001b[0m fastbook\u001b[39m.\u001b[39msetup_book()\n",
16
+ "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'fastbook'"
17
+ ]
18
+ }
19
+ ],
20
+ "source": [
21
+ "![ -e /content ] && pip install -Uqq fastbook\n",
22
+ "\n",
23
+ "import fastbook\n",
24
+ "fastbook.setup_book()"
25
+ ]
26
+ }
27
+ ],
28
+ "metadata": {
29
+ "kernelspec": {
30
+ "display_name": "Python 3 (ipykernel)",
31
+ "language": "python",
32
+ "name": "python3"
33
+ },
34
+ "language_info": {
35
+ "codemirror_mode": {
36
+ "name": "ipython",
37
+ "version": 3
38
+ },
39
+ "file_extension": ".py",
40
+ "mimetype": "text/x-python",
41
+ "name": "python",
42
+ "nbconvert_exporter": "python",
43
+ "pygments_lexer": "ipython3",
44
+ "version": "3.10.12"
45
+ }
46
+ },
47
+ "nbformat": 4,
48
+ "nbformat_minor": 2
49
+ }
app.ipynb ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "metadata": {},
7
+ "outputs": [],
8
+ "source": [
9
+ "from fastai.vision.all import *\n",
10
+ "import gradio as gr\n",
11
+ "\n",
12
+ "def is_cat(x): return x[0].isupper()\n",
13
+ "\n",
14
+ "# Cell\n",
15
+ "learn = load_learner('model.pkl')\n",
16
+ "\n",
17
+ "categories = ('Dog', 'Cat')\n",
18
+ "\n",
19
+ "def classify_image(img):\n",
20
+ " pred,pred_idx,probs = learn.predict(img)\n",
21
+ " return dict(zip(categories, map(float, probs)))\n",
22
+ "\n",
23
+ "image = gr.inputs.Image(shape=(192, 192))\n",
24
+ "label = gr.outputs.Label()\n",
25
+ "\n",
26
+ "examples = ['dog.jpg', 'cat.jpg', 'two-dog.jpg']\n",
27
+ "\n",
28
+ "intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)\n",
29
+ "intf.launch(inline=False)\n"
30
+ ]
31
+ }
32
+ ],
33
+ "metadata": {
34
+ "language_info": {
35
+ "name": "python"
36
+ },
37
+ "orig_nbformat": 4
38
+ },
39
+ "nbformat": 4,
40
+ "nbformat_minor": 2
41
+ }
app.py CHANGED
@@ -3,12 +3,10 @@
3
  from fastai.vision.all import *
4
  import gradio as gr
5
 
6
- def is_cat(x): return x[0].isupper()
7
-
8
  # Cell
9
- learn = load_learner('model.pkl')
10
 
11
- categories = ('Dog', 'Cat')
12
 
13
  def classify_image(img):
14
  pred,pred_idx,probs = learn.predict(img)
@@ -17,7 +15,7 @@ def classify_image(img):
17
  image = gr.inputs.Image(shape=(192, 192))
18
  label = gr.outputs.Label()
19
 
20
- examples = ['dog.jpg', 'cat.jpg', 'two-dog.jpg']
21
 
22
  intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
23
  intf.launch(inline=False)
3
  from fastai.vision.all import *
4
  import gradio as gr
5
 
 
 
6
  # Cell
7
+ learn = load_learner('pandaBears.pkl')
8
 
9
+ categories = ('Panda', 'Bear')
10
 
11
  def classify_image(img):
12
  pred,pred_idx,probs = learn.predict(img)
15
  image = gr.inputs.Image(shape=(192, 192))
16
  label = gr.outputs.Label()
17
 
18
+ examples = ['panda.jpg', 'panda-cartoon.jpg', 'raccoon.jpg', 'bear.jpg']
19
 
20
  intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
21
  intf.launch(inline=False)
cat.jpg β†’ archive.zip RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:2fcc21f8f005df284a8e31d6128fb11946250d9f019c7542311255ca50d0660f
3
- size 1058516
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3b1169e14b312c78906ec197085a081c9cdb63ce5d8631645aef9c8f888e1d40
3
+ size 12271601
bear.jpg ADDED
flagged/img/tmp4h5dh0a9.jpg ADDED
flagged/log.csv ADDED
@@ -0,0 +1,2 @@
 
 
1
+ img,output,flag,username,timestamp
2
+ /Users/nazha/nazha-ai/panda-recognizer/flagged/img/tmp4h5dh0a9.jpg,/Users/nazha/nazha-ai/panda-recognizer/flagged/output/tmpu0ljv__f.json,,,2023-07-16 18:40:46.430310
flagged/output/tmpu0ljv__f.json ADDED
@@ -0,0 +1 @@
 
1
+ {"label": "Bear", "confidences": [{"label": "Bear", "confidence": 0.5269274711608887}, {"label": "Panda", "confidence": 0.47307252883911133}]}
images/Panda-002.jpg ADDED
images/bear.jpg ADDED
panda-cartoon.jpg ADDED
panda.jpg ADDED
dog.jpg β†’ pandaBears.pkl RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:d53a77b0be82993ed44bbb9244cda42bf460f8dcdf87ff3cfdbfdc7191ff418d
3
- size 121984
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:70a98b7e4e8868b815f8f765be173cbff381085689a02cdbd67aac67f4cc04ee
3
+ size 87466032
raccoon.jpg ADDED
train.ipynb ADDED
The diff for this file is too large to render. See raw diff
two-dog.jpg DELETED

Git LFS Details

  • SHA256: c3b633cdc066a601d3ecf16214f9a40760a2ff82bc88de39c019e30503d99ac6
  • Pointer size: 129 Bytes
  • Size of remote file: 5.94 kB