Yoxas commited on
Commit
8e2a2a1
·
verified ·
1 Parent(s): f7aab3d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import gradio as gr
2
  import pandas as pd
3
  from transformers import pipeline
 
4
 
5
  # Load CSV data
6
  data = pd.read_csv('documents.csv')
@@ -10,6 +11,7 @@ data = pd.read_csv('documents.csv')
10
  qa_model = pipeline("question-answering", model="distilbert-base-uncased-distilled-squad")
11
 
12
  # Function to retrieve the relevant document and generate a response
 
13
  def retrieve_and_generate(question):
14
  # Combine all abstracts into a single string (you can improve this by better retrieval methods)
15
  abstracts = " ".join(data['Abstract'].fillna("").tolist())
 
1
  import gradio as gr
2
  import pandas as pd
3
  from transformers import pipeline
4
+ import spaces
5
 
6
  # Load CSV data
7
  data = pd.read_csv('documents.csv')
 
11
  qa_model = pipeline("question-answering", model="distilbert-base-uncased-distilled-squad")
12
 
13
  # Function to retrieve the relevant document and generate a response
14
+ @spaces.GPU(duration=120)
15
  def retrieve_and_generate(question):
16
  # Combine all abstracts into a single string (you can improve this by better retrieval methods)
17
  abstracts = " ".join(data['Abstract'].fillna("").tolist())