ฉันกำลังพยายามทำให้เครื่องเรียนนางแบบและใช้ django ที่เหลือส่วนเฟรมเวิร์กจะเชื่อมต่อมัน ของโครงสร้างของโฟลเดอร์เป็นเหมือนนี้
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
ใน chatbot_predict.py แฟ้มฉันกำลังพยายามโหลดรุ่นและได้ prediction ใช้มันคุณครูแต่พอกลับมา รหัสเป็นแบบนี้
import joblib
loaded_model = joblib.load ('model.sav')
def get_prediction (message, loaded_model = loaded_model):
return prediction
ตอนที่ฉันวิ่งหนีแฟ้มนี้โดยใช้ ไพธอน chatbot_predict.py ใช้บรรทัดคำสั่งมันทำงานสบายดี แต่ตอนที่ฉันนำเข้านี้ get_prediction ฟังก์ชันใน server/chat/views.py แล้วก็วิ่ง ปลั๊กอินสำหรับไพธอน manage.py runserver มันทำให้ข้อผิดพลาด
ฉันทำอะไรผิดไปนั้น FileNotFoundError?