Update app.py
Browse files
app.py
CHANGED
@@ -1,16 +1,26 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
from tempfile import NamedTemporaryFile
|
|
|
4 |
from PyPDF2 import PdfReader
|
5 |
-
from
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
import numpy as np
|
7 |
-
from bark import SAMPLE_RATE, generate_audio, preload_models
|
8 |
-
from scipy.io.wavfile import write as write_wav
|
9 |
import torch
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
def read_pdf(pdf_path):
|
12 |
# create a PDF file object
|
13 |
-
pdfFileObj = open(
|
14 |
# create a PDF reader object
|
15 |
pdfReaded = PyPDF2.PdfReader(pdfFileObj)
|
16 |
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
from tempfile import NamedTemporaryFile
|
4 |
+
import PyPDF2
|
5 |
from PyPDF2 import PdfReader
|
6 |
+
from pdfminer.high_level import extract_pages, extract_text
|
7 |
+
import pdfplumber
|
8 |
+
from PIL import Image
|
9 |
+
from pdf2image import convert_from_path
|
10 |
+
from pdfminer.layout import LTTextContainer, LTChar, LTRect, LTFigure
|
11 |
+
import pytesseract
|
12 |
+
import os
|
13 |
import numpy as np
|
|
|
|
|
14 |
import torch
|
15 |
+
import sentencepiece
|
16 |
+
import soundfile as sf
|
17 |
+
from IPython.display import Audio
|
18 |
+
from datasets import load_dataset
|
19 |
+
from transformers import SpeechT5HifiGan
|
20 |
|
21 |
def read_pdf(pdf_path):
|
22 |
# create a PDF file object
|
23 |
+
pdfFileObj = open(pdf_path, 'rb')
|
24 |
# create a PDF reader object
|
25 |
pdfReaded = PyPDF2.PdfReader(pdfFileObj)
|
26 |
|