Spaces:
Runtime error
Runtime error
Update src/models.py
Browse files- src/models.py +15 -0
src/models.py
CHANGED
|
@@ -1,6 +1,21 @@
|
|
| 1 |
from transformers import pipeline
|
| 2 |
from langchain.llms import CTransformers
|
| 3 |
from langchain.prompts import ChatPromptTemplate
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
# Text classification model for routing input
|
| 6 |
classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli")
|
|
|
|
| 1 |
from transformers import pipeline
|
| 2 |
from langchain.llms import CTransformers
|
| 3 |
from langchain.prompts import ChatPromptTemplate
|
| 4 |
+
import os
|
| 5 |
+
|
| 6 |
+
# Download models function
|
| 7 |
+
def download_models():
|
| 8 |
+
"""
|
| 9 |
+
Downloads the necessary models for the chatbot using wget.
|
| 10 |
+
This function retrieves two models:
|
| 11 |
+
1. BioMistral-7B - A medical-specific language model.
|
| 12 |
+
2. Llama-2-7B - A general-purpose language model.
|
| 13 |
+
"""
|
| 14 |
+
os.system('wget -O BioMistral-7B.Q4_K_M.gguf "https://huggingface.co/MaziyarPanahi/BioMistral-7B-GGUF/resolve/main/BioMistral-7B.Q4_K_M.gguf?download=true"')
|
| 15 |
+
os.system('wget -O llama-2-7b.Q4_K_M.gguf "https://huggingface.co/TheBloke/Llama-2-7B-GGUF/resolve/main/llama-2-7b.Q4_K_M.gguf?download=true"')
|
| 16 |
+
|
| 17 |
+
# Call the download function to ensure the models are available before starting the bot
|
| 18 |
+
download_models()
|
| 19 |
|
| 20 |
# Text classification model for routing input
|
| 21 |
classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli")
|