Victor Eisikovich commited on
Commit ·
4ffe84c
1
Parent(s): 0920a68
Add application file with learning
Browse files
app.py
CHANGED
|
@@ -1,6 +1,13 @@
|
|
| 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")
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from fastai.vision.all import *
|
| 3 |
|
| 4 |
def greet(name):
|
| 5 |
+
path = untar_data(URLs.PETS)
|
| 6 |
+
dls = ImageDataLoaders.from_name_re(path, get_image_files(path/'images'), pat='(.+)_\d+.jpg', item_tfms=Resize(460), batch_tfms=aug_transforms(size=224, min_scale=0.75))
|
| 7 |
+
learn = vision_learner(dls, models.resnet50, metrics=accuracy)
|
| 8 |
+
learn.fine_tune(1)
|
| 9 |
+
learn.path = Path('.')
|
| 10 |
+
learn.export()
|
| 11 |
return "Hello " + name + "!!"
|
| 12 |
|
| 13 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|