Spaces:
Runtime error
Runtime error
update code formatting
Browse files- gradio_article.md +3 -3
gradio_article.md
CHANGED
@@ -13,20 +13,20 @@ Jeremy presented in session 1 of the 2022 fastai course into a regression task.
|
|
13 |
|
14 |
1. Creating a labeling function that returns a float, 0.0 if it is a DC character and 1.0 if it is a Marvel character
|
15 |
|
16 |
-
```
|
17 |
def is_marvel(img):
|
18 |
return 1. if img.parent.name.lower().startswith("marvel") else 0.
|
19 |
```
|
20 |
|
21 |
2. Updating our `DataBlock`to use a `RegressionBlock` for our targets, and then assigning our labeling function above to the `get_y` argument.
|
22 |
|
23 |
-
```
|
24 |
blocks=(ImageBlock, RegressionBlock)
|
25 |
```
|
26 |
|
27 |
3. Updating our call to `vision_learner` to use a regression friendly metric like RMSE, as well as specifying a `y_range` to constrain our predictions to the expected range of between 0 and 1.
|
28 |
|
29 |
-
```
|
30 |
learn = vision_learner(dls, resnet18, metrics=rmse, y_range=(0, 1))
|
31 |
```
|
32 |
|
|
|
13 |
|
14 |
1. Creating a labeling function that returns a float, 0.0 if it is a DC character and 1.0 if it is a Marvel character
|
15 |
|
16 |
+
```python
|
17 |
def is_marvel(img):
|
18 |
return 1. if img.parent.name.lower().startswith("marvel") else 0.
|
19 |
```
|
20 |
|
21 |
2. Updating our `DataBlock`to use a `RegressionBlock` for our targets, and then assigning our labeling function above to the `get_y` argument.
|
22 |
|
23 |
+
```python
|
24 |
blocks=(ImageBlock, RegressionBlock)
|
25 |
```
|
26 |
|
27 |
3. Updating our call to `vision_learner` to use a regression friendly metric like RMSE, as well as specifying a `y_range` to constrain our predictions to the expected range of between 0 and 1.
|
28 |
|
29 |
+
```python
|
30 |
learn = vision_learner(dls, resnet18, metrics=rmse, y_range=(0, 1))
|
31 |
```
|
32 |
|