parthb3 commited on
Commit
dfb4951
1 Parent(s): 7a9f34b

let's deploy to huggingface spaces

Browse files
Files changed (1) hide show
  1. app.py +36 -4
app.py CHANGED
@@ -1,7 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ # -*- coding: utf-8 -*-
2
+ """car_year_finder_p2.ipynb
3
+
4
+ Automatically generated by Colaboratory.
5
+
6
+ Original file is located at
7
+ https://colab.research.google.com/drive/1O0_3A82axlMsWaCiXpSv2cM0frscKrsB
8
+ """
9
+
10
+ #!pip install -Uqq fastai
11
+ #!pip install -Uqq gradio
12
+
13
+ from fastai.vision.all import *
14
+ from fastai.vision.widgets import *
15
  import gradio as gr
16
 
17
+ #learn = load_learner(Path('/content/drive/MyDrive/AI_Models')/'car_year_finder1.pkl')
18
+ #im = PILImage.create('/content/drive/MyDrive/tesla.png')
19
+ #im.thumbnail((192,192))
20
+ #learn.predict(im)
21
+
22
+ categories = ('before 1960','from 1970 to 1980','from 1990 to 2000', 'from 2020')
23
+ learn = load_learner('car_year_finder1.pkl')
24
+ def classify_image(img):
25
+ pred, idx, probs = learn.predict(img)
26
+ return dict(zip(categories,map(float,probs)))
27
+
28
+ #classify_image(im)
29
+
30
+ image = gr.inputs.Image(shape=(192,192))
31
+ label = gr.outputs.Label()
32
+ #examples = ['tesla.png','model_t.jpg']
33
+ intf=gr.Interface(fn=classify_image, inputs=image, outputs=label)
34
+ intf.launch()
35
+
36
+
37
+
38
+
39