Eu sunt încercarea de a face un model de învățare mașină și de a folosi django rest cadru pentru a-l conecta. Dosarul meu este ca aceasta structura
server
|
+-- chat
| |
| +-- DistilBertModel
| | |
| | +-- OurModel
| | | |
| | | +-- BERT_model.py
| | | +-- chatbot.py
| | | +-- chatbot_predict.py
| | | +-- model.sav
| | +-- data
| | | |
| | | +-- test_chatbot.csv
| | | +-- answers.json
| +-- migrations
| +-- __init__.py
| +-- admin.py
| +-- apps.py
| +-- models.py
| +-- serializers.py
| +-- tests.py
| +-- urls.py
| +-- views.py
+-- core
|
+-- templates
|
+-- db.sqlite3
|
+-- manage.py
|
+-- requirements.txt
În chatbot_predict.py fișier sunt încercarea de a încărca modelul și a obține o predicție folosind ca model. Codul este astfel de prognoze
import joblib
loaded_model = joblib.load ('model.sav')
def get_prediction (message, loaded_model = loaded_model):
return prediction
Atunci când am rula acest fișier folosind python chatbot_predict.py folosind linia de comandă funcționează bine. Cu toate acestea, atunci când am importa acest get_prediction în funcție server/chat/views.py și rula python manage.py runserver dă eroare
Cu ce am greșit pentru a obține că FileNotFoundError ?