jeremygustine commited on
Commit
47b1711
·
1 Parent(s): 8a8f343
Files changed (5) hide show
  1. .gitignore +2 -0
  2. README.md +11 -0
  3. app.py +18 -2
  4. model.pkl +3 -0
  5. requirements.txt +1 -0
.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ .idea/
2
+ project/
README.md CHANGED
@@ -10,3 +10,14 @@ pinned: false
10
  ---
11
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
10
  ---
11
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
13
+
14
+
15
+ Create a virtual environment: `python3 -m venv project`
16
+ Activate virtual environment: `source project/bin/activate`
17
+ Install project dependencies: `pip install -r requirements.txt`
18
+ Install a new dependency: `python -m pip install fastai`
19
+ Save to requirements file: `pip freeze > requirements.txt`
20
+
21
+ brew update
22
+ brew install git-lfs
23
+ git lfs install
app.py CHANGED
@@ -1,7 +1,23 @@
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
  import gradio as gr
2
+ from fastai.vision.all import *
3
+ from fastdownload import download_url
4
+ from PIL import Image
5
+ import requests
6
+ from io import StringIO
7
 
8
+
9
+
10
+
11
+
12
+ def greet(url):
13
+ # dest_file = 'hot_dog.jpg'
14
+ # download_url(url, dest_file, show_progress=False)
15
+ # image = PILImage.create(dest_file)
16
+ response = requests.get(url)
17
+ image = Image.open(StringIO(response.content))
18
+ predicted_category, _, probs = learn.predict(image)
19
+ # return "Hello " + name + "!!"
20
+ return predicted_category
21
 
22
  iface = gr.Interface(fn=greet, inputs="text", outputs="text")
23
  iface.launch()
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:be1da2d9e67d5706d3b9b7df738e49eaa7850c9022e7919aa308e87add4234d7
3
+ size 46958255
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ fastai