Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@ from sklearn.feature_extraction.text import TfidfVectorizer
|
|
4 |
from sklearn.metrics.pairwise import cosine_similarity
|
5 |
from transformers import GPT2Tokenizer, GPT2LMHeadModel
|
6 |
from sentence_transformers import SentenceTransformer, util
|
|
|
7 |
import torch
|
8 |
|
9 |
import gdown
|
@@ -21,10 +22,12 @@ except UnicodeDecodeError:
|
|
21 |
vectorizer = TfidfVectorizer(stop_words='english')
|
22 |
X_tfidf = vectorizer.fit_transform(medical_df['Questions'])
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
|
|
28 |
|
29 |
# Load pre-trained Sentence Transformer model
|
30 |
sbert_model_name = "paraphrase-MiniLM-L6-v2"
|
|
|
4 |
from sklearn.metrics.pairwise import cosine_similarity
|
5 |
from transformers import GPT2Tokenizer, GPT2LMHeadModel
|
6 |
from sentence_transformers import SentenceTransformer, util
|
7 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
8 |
import torch
|
9 |
|
10 |
import gdown
|
|
|
22 |
vectorizer = TfidfVectorizer(stop_words='english')
|
23 |
X_tfidf = vectorizer.fit_transform(medical_df['Questions'])
|
24 |
|
25 |
+
|
26 |
+
# Load TinyLlama-15M model and tokenizer
|
27 |
+
model_name = "nickypro/tinyllama-15M"
|
28 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
29 |
+
model = AutoModelForCausalLM.from_pretrained(model_name)
|
30 |
+
|
31 |
|
32 |
# Load pre-trained Sentence Transformer model
|
33 |
sbert_model_name = "paraphrase-MiniLM-L6-v2"
|