Alexvatti commited on
Commit
ca43ba3
·
verified ·
1 Parent(s): c30937f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -10,7 +10,7 @@ zero = torch.Tensor([0]).cuda()
10
  print(zero.device)
11
 
12
  device = 0 if torch.cuda.is_available() else -1
13
- torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
14
  # Load LLM model for classification
15
  classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli",device=device)
16
 
@@ -34,7 +34,7 @@ sub_request_types = {
34
  }
35
 
36
  # Function to extract text from PDFs
37
- @spaces.GPU
38
  def extract_text_from_pdf(pdf_path):
39
  with pdfplumber.open(pdf_path) as pdf:
40
  text = "\n".join(page.extract_text() for page in pdf.pages if page.extract_text())
@@ -56,7 +56,7 @@ def classify_text(text):
56
  return f"Request Type: {main_category}\nSub Request Type: {sub_category}\nConfidence Score: {confidence:.2f}"
57
 
58
  # Gradio UI
59
- @spaces.GPU
60
  def process_pdf(file):
61
  text = extract_text_from_pdf(file.name)
62
  return classify_text(text)
 
10
  print(zero.device)
11
 
12
  device = 0 if torch.cuda.is_available() else -1
13
+
14
  # Load LLM model for classification
15
  classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli",device=device)
16
 
 
34
  }
35
 
36
  # Function to extract text from PDFs
37
+
38
  def extract_text_from_pdf(pdf_path):
39
  with pdfplumber.open(pdf_path) as pdf:
40
  text = "\n".join(page.extract_text() for page in pdf.pages if page.extract_text())
 
56
  return f"Request Type: {main_category}\nSub Request Type: {sub_category}\nConfidence Score: {confidence:.2f}"
57
 
58
  # Gradio UI
59
+
60
  def process_pdf(file):
61
  text = extract_text_from_pdf(file.name)
62
  return classify_text(text)