Yoxas commited on
Commit
1ca1417
·
verified ·
1 Parent(s): 4941cda

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -2
app.py CHANGED
@@ -27,7 +27,7 @@ tokenizer = AutoTokenizer.from_pretrained("openai-community/gpt2")
27
  model_response = AutoModelForCausalLM.from_pretrained("openai-community/gpt2").to(device)
28
 
29
  # Load the NLU model for intent detection
30
- nlu_model = AutoModelForSequenceClassification.from_pretrained("distilbert/distilbert-base-uncased-finetuned-sst-2-english")
31
 
32
  # Define the function to find the most relevant document
33
  @spaces.GPU(duration=120)
@@ -38,7 +38,6 @@ def retrieve_relevant_doc(query):
38
  return df.iloc[best_match_idx]['Abstract']
39
 
40
  # Define the function to detect intent
41
- @spaces.GPU(duration=120)
42
  def detect_intent(query):
43
  inputs = tokenizer(query, return_tensors="pt").to(device)
44
  outputs = nlu_model(inputs["input_ids"], attention_mask=inputs["attention_mask"])
 
27
  model_response = AutoModelForCausalLM.from_pretrained("openai-community/gpt2").to(device)
28
 
29
  # Load the NLU model for intent detection
30
+ nlu_model = AutoModelForSequenceClassification.from_pretrained("distilbert/distilbert-base-uncased-finetuned-sst-2-english").to(device)
31
 
32
  # Define the function to find the most relevant document
33
  @spaces.GPU(duration=120)
 
38
  return df.iloc[best_match_idx]['Abstract']
39
 
40
  # Define the function to detect intent
 
41
  def detect_intent(query):
42
  inputs = tokenizer(query, return_tensors="pt").to(device)
43
  outputs = nlu_model(inputs["input_ids"], attention_mask=inputs["attention_mask"])