Przemek Pietrzkiewicz commited on
Commit
efc8448
1 Parent(s): cc23d03

Add everything apart from the big model file

Browse files
Files changed (5) hide show
  1. .gitignore +3 -0
  2. app.py +11 -2
  3. check_pytorch.py +13 -0
  4. invaders-and-friends.ipynb +0 -0
  5. requirements.txt +87 -0
.gitignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ .env
2
+ .DS_Store
3
+ .ipynb_checkpoints
app.py CHANGED
@@ -1,7 +1,16 @@
 
1
  import gradio as gr
2
 
3
  def greet(name):
4
  return "Hello " + name + "!!"
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
 
 
 
 
 
1
+ from fastai.vision.all import *
2
  import gradio as gr
3
 
4
  def greet(name):
5
  return "Hello " + name + "!!"
6
 
7
+
8
+ learn = load_learner('model-v7.pkl')
9
+
10
+ labels = learn.dls.vocab
11
+ def predict(img):
12
+ img = PILImage.create(img)
13
+ pred,pred_idx,probs = learn.predict(img)
14
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
15
+
16
+ gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)
check_pytorch.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+
3
+ # Check that MPS is available
4
+ if not torch.backends.mps.is_available():
5
+ if not torch.backends.mps.is_built():
6
+ print("MPS not available because the current PyTorch install was not "
7
+ "built with MPS enabled.")
8
+ else:
9
+ print("MPS not available because the current MacOS version is not 12.3+ "
10
+ "and/or you do not have an MPS-enabled device on this machine.")
11
+
12
+ else:
13
+ print("all good")
invaders-and-friends.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
requirements.txt ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ aiofiles==23.2.1
2
+ altair==5.1.2
3
+ annotated-types==0.6.0
4
+ anyio==3.7.1
5
+ attrs==23.1.0
6
+ blis==0.7.11
7
+ catalogue==2.0.10
8
+ certifi==2023.7.22
9
+ charset-normalizer==3.3.0
10
+ click==8.1.7
11
+ cloudpathlib==0.16.0
12
+ confection==0.1.3
13
+ contourpy==1.1.1
14
+ cycler==0.12.1
15
+ cymem==2.0.8
16
+ fastai==2.7.13
17
+ fastapi==0.103.2
18
+ fastcore==1.5.29
19
+ fastdownload==0.0.7
20
+ fastprogress==1.0.3
21
+ ffmpy==0.3.1
22
+ filelock==3.12.4
23
+ fonttools==4.43.1
24
+ fsspec==2023.9.2
25
+ gradio==3.49.0
26
+ gradio_client==0.6.1
27
+ h11==0.14.0
28
+ httpcore==0.18.0
29
+ httpx==0.25.0
30
+ huggingface-hub==0.18.0
31
+ idna==3.4
32
+ importlib-resources==6.1.0
33
+ Jinja2==3.1.2
34
+ joblib==1.3.2
35
+ jsonschema==4.19.1
36
+ jsonschema-specifications==2023.7.1
37
+ kiwisolver==1.4.5
38
+ langcodes==3.3.0
39
+ MarkupSafe==2.1.3
40
+ matplotlib==3.8.0
41
+ mpmath==1.3.0
42
+ murmurhash==1.0.10
43
+ networkx==3.1
44
+ numpy==1.26.1
45
+ orjson==3.9.9
46
+ packaging==23.2
47
+ pandas==2.1.1
48
+ Pillow==10.1.0
49
+ preshed==3.0.9
50
+ pydantic==2.4.2
51
+ pydantic_core==2.10.1
52
+ pydub==0.25.1
53
+ pyparsing==3.1.1
54
+ python-dateutil==2.8.2
55
+ python-multipart==0.0.6
56
+ pytz==2023.3.post1
57
+ PyYAML==6.0.1
58
+ referencing==0.30.2
59
+ requests==2.31.0
60
+ rpds-py==0.10.6
61
+ scikit-learn==1.3.1
62
+ scipy==1.11.3
63
+ semantic-version==2.10.0
64
+ six==1.16.0
65
+ smart-open==6.4.0
66
+ sniffio==1.3.0
67
+ spacy==3.7.2
68
+ spacy-legacy==3.0.12
69
+ spacy-loggers==1.0.5
70
+ srsly==2.4.8
71
+ starlette==0.27.0
72
+ sympy==1.12
73
+ thinc==8.2.1
74
+ threadpoolctl==3.2.0
75
+ toolz==0.12.0
76
+ torch==2.1.0
77
+ torchaudio==2.1.0
78
+ torchvision==0.16.0
79
+ tqdm==4.66.1
80
+ typer==0.9.0
81
+ typing_extensions==4.8.0
82
+ tzdata==2023.3
83
+ urllib3==2.0.7
84
+ uvicorn==0.23.2
85
+ wasabi==1.1.2
86
+ weasel==0.3.3
87
+ websockets==11.0.3