Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -45,7 +45,7 @@ def split_text(text, chunk_size=1024):
|
|
45 |
yield ' '.join(words[i:i + chunk_size])
|
46 |
|
47 |
# Function to classify text using LED model
|
48 |
-
@spaces.GPU
|
49 |
def classify_text(text):
|
50 |
try:
|
51 |
return classifier(text)[0]['label']
|
@@ -53,7 +53,7 @@ def classify_text(text):
|
|
53 |
return "Unable to classify"
|
54 |
|
55 |
# Function to summarize text using the summarizer model
|
56 |
-
@spaces.GPU
|
57 |
def summarize_text(text, max_length=100, min_length=30):
|
58 |
try:
|
59 |
return summarizer(text, max_length=max_length, min_length=min_length, do_sample=False)[0]['summary_text']
|
@@ -61,7 +61,7 @@ def summarize_text(text, max_length=100, min_length=30):
|
|
61 |
return "Unable to summarize"
|
62 |
|
63 |
# Function to extract a title-like summary from the beginning of the text
|
64 |
-
@spaces.GPU
|
65 |
def extract_title(text, max_length=20):
|
66 |
try:
|
67 |
return summarizer(text, max_length=max_length, min_length=5, do_sample=False)[0]['summary_text']
|
@@ -72,7 +72,7 @@ def extract_title(text, max_length=20):
|
|
72 |
# output_folder_path = '/content/drive/My Drive/path_to_output' # Adjust this to your actual path
|
73 |
|
74 |
# Define the Gradio interface for file upload and download
|
75 |
-
@spaces.GPU
|
76 |
def process_files(pdf_files):
|
77 |
data = []
|
78 |
for pdf_file in pdf_files:
|
|
|
45 |
yield ' '.join(words[i:i + chunk_size])
|
46 |
|
47 |
# Function to classify text using LED model
|
48 |
+
@spaces.GPU(duration=120)
|
49 |
def classify_text(text):
|
50 |
try:
|
51 |
return classifier(text)[0]['label']
|
|
|
53 |
return "Unable to classify"
|
54 |
|
55 |
# Function to summarize text using the summarizer model
|
56 |
+
@spaces.GPU(duration=120)
|
57 |
def summarize_text(text, max_length=100, min_length=30):
|
58 |
try:
|
59 |
return summarizer(text, max_length=max_length, min_length=min_length, do_sample=False)[0]['summary_text']
|
|
|
61 |
return "Unable to summarize"
|
62 |
|
63 |
# Function to extract a title-like summary from the beginning of the text
|
64 |
+
@spaces.GPU(duration=120)
|
65 |
def extract_title(text, max_length=20):
|
66 |
try:
|
67 |
return summarizer(text, max_length=max_length, min_length=5, do_sample=False)[0]['summary_text']
|
|
|
72 |
# output_folder_path = '/content/drive/My Drive/path_to_output' # Adjust this to your actual path
|
73 |
|
74 |
# Define the Gradio interface for file upload and download
|
75 |
+
@spaces.GPU(duration=120)
|
76 |
def process_files(pdf_files):
|
77 |
data = []
|
78 |
for pdf_file in pdf_files:
|