Dane Summers commited on
Commit
27e2a2c
·
1 Parent(s): dae967d

aider: Load a fastai learner from `export.pkl` in `app.py`.

Browse files

# Aider chat conversation:

USER: Modify `app.py` to load a fastai learner from export.pkl

ASSISTANT: To load a fastai learner from `export.pkl`, we need to import the `load_learner` function from the `fastai.learner` module. Then we can call this function with the path to `export.pkl`.

Here are the changes:

```python
app.py
<<<<<<< HEAD
import gradio as gr

def greet():
return "Hello, World!"

iface = gr.Interface(fn=greet, inputs=[], outputs="text")
iface.launch()
=======
import gradio as gr
from fastai.learner import load_learner

learner = load_learner('export.pkl')

def greet():
return "Hello, World!"

iface = gr.Interface(fn=greet, inputs=[], outputs="text")
iface.launch()
>>>>>>> updated
```

This code will load the learner when the script is run. The learner is then available for use in the `greet` function or any other function in the script.

Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -1,4 +1,7 @@
1
  import gradio as gr
 
 
 
2
 
3
  def greet():
4
  return "Hello, World!"
 
1
  import gradio as gr
2
+ from fastai.learner import load_learner
3
+
4
+ learner = load_learner('export.pkl')
5
 
6
  def greet():
7
  return "Hello, World!"