Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,22 +1,21 @@
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
import PyPDF2
|
3 |
import pdfplumber
|
4 |
-
|
5 |
from transformers import pipeline
|
6 |
from PyPDF2 import PdfReader
|
7 |
-
|
8 |
import torch
|
9 |
-
|
10 |
import soundfile as sf
|
11 |
-
|
12 |
from IPython.display import Audio
|
13 |
-
|
14 |
from datasets import load_dataset
|
15 |
-
|
16 |
from pdfminer.high_level import extract_pages, extract_text
|
17 |
-
|
18 |
import io
|
19 |
|
|
|
|
|
20 |
summarization = pipeline ('summarization', model = "pszemraj/long-t5-tglobal-base-16384-book-summary")
|
21 |
|
22 |
def summarize_and_speech(pdf_file):
|
@@ -32,7 +31,6 @@ def summarize_and_speech(pdf_file):
|
|
32 |
|
33 |
return summary, audio_data
|
34 |
|
35 |
-
|
36 |
iface = gr.Interface(
|
37 |
fn= summarize_and_speech,
|
38 |
inputs=gr.File(label="Upload PDF", type="binary"),
|
|
|
1 |
+
#https://huggingface.co/spaces/gianb/PDF_Summarized_TTS
|
2 |
+
|
3 |
+
# Here are the imports
|
4 |
+
|
5 |
import gradio as gr
|
6 |
import PyPDF2
|
7 |
import pdfplumber
|
|
|
8 |
from transformers import pipeline
|
9 |
from PyPDF2 import PdfReader
|
|
|
10 |
import torch
|
|
|
11 |
import soundfile as sf
|
|
|
12 |
from IPython.display import Audio
|
|
|
13 |
from datasets import load_dataset
|
|
|
14 |
from pdfminer.high_level import extract_pages, extract_text
|
|
|
15 |
import io
|
16 |
|
17 |
+
#Here is the code
|
18 |
+
|
19 |
summarization = pipeline ('summarization', model = "pszemraj/long-t5-tglobal-base-16384-book-summary")
|
20 |
|
21 |
def summarize_and_speech(pdf_file):
|
|
|
31 |
|
32 |
return summary, audio_data
|
33 |
|
|
|
34 |
iface = gr.Interface(
|
35 |
fn= summarize_and_speech,
|
36 |
inputs=gr.File(label="Upload PDF", type="binary"),
|