Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ import torch
|
|
3 |
from sentence_transformers import SentenceTransformer, util
|
4 |
import gradio as gr
|
5 |
import json
|
6 |
-
from transformers import AutoTokenizer,
|
7 |
import spaces
|
8 |
|
9 |
# Ensure you have GPU support
|
@@ -20,8 +20,8 @@ embeddings = torch.tensor(df['embedding'].tolist(), device=device)
|
|
20 |
model = SentenceTransformer('all-MiniLM-L6-v2', device=device)
|
21 |
|
22 |
# Load the LLaMA model for response generation
|
23 |
-
llama_tokenizer = AutoTokenizer.from_pretrained("
|
24 |
-
llama_model =
|
25 |
|
26 |
# Define the function to find the most relevant document
|
27 |
@spaces.GPU(duration=120)
|
|
|
3 |
from sentence_transformers import SentenceTransformer, util
|
4 |
import gradio as gr
|
5 |
import json
|
6 |
+
from transformers import AutoTokenizer, AutoModelForQuestionAnswering
|
7 |
import spaces
|
8 |
|
9 |
# Ensure you have GPU support
|
|
|
20 |
model = SentenceTransformer('all-MiniLM-L6-v2', device=device)
|
21 |
|
22 |
# Load the LLaMA model for response generation
|
23 |
+
llama_tokenizer = AutoTokenizer.from_pretrained("distilbert/distilbert-base-uncased-distilled-squad")
|
24 |
+
llama_model = AutoModelForQuestionAnswering.from_pretrained("distilbert/distilbert-base-uncased-distilled-squad").to(device)
|
25 |
|
26 |
# Define the function to find the most relevant document
|
27 |
@spaces.GPU(duration=120)
|