Yoxas commited on
Commit
915f490
·
verified ·
1 Parent(s): 236d6fa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
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, AutoModelForQuestionAnswering, AutoModelForSequenceClassification
7
  import spaces
8
 
9
  # Ensure you have GPU support
@@ -20,11 +20,11 @@ embeddings = torch.tensor(df['embedding'].tolist(), device=device)
20
  model = SentenceTransformer('all-MiniLM-L6-v2', device=device)
21
 
22
  # Load the ai model for response generation
23
- tokenizer = AutoTokenizer.from_pretrained("distilbert/distilbert-base-uncased-distilled-squad")
24
- model_response = AutoModelForQuestionAnswering.from_pretrained("distilbert/distilbert-base-uncased-distilled-squad").to(device)
25
 
26
  # Load the NLU model for intent detection
27
- nlu_model = AutoModelForSequenceClassification.from_pretrained("bert-base-uncased-finetuned-sst-2-english").to(device)
28
 
29
  # Define the function to find the most relevant document
30
  @spaces.GPU(duration=120)
 
3
  from sentence_transformers import SentenceTransformer, util
4
  import gradio as gr
5
  import json
6
+ from transformers import AutoTokenizer, AutoModelForCausalLM, AutoModelForSequenceClassification
7
  import spaces
8
 
9
  # Ensure you have GPU support
 
20
  model = SentenceTransformer('all-MiniLM-L6-v2', device=device)
21
 
22
  # Load the ai model for response generation
23
+ tokenizer = AutoTokenizer.from_pretrained("openai-community/gpt2-medium")
24
+ model_response = AutoModelForCausalLM.from_pretrained("openai-community/gpt2-medium").to(device)
25
 
26
  # Load the NLU model for intent detection
27
+ nlu_model = AutoModelForSequenceClassification.from_pretrained("distilbert/distilbert-base-uncased-finetuned-sst-2-english").to(device)
28
 
29
  # Define the function to find the most relevant document
30
  @spaces.GPU(duration=120)