Spaces:
Sleeping
Sleeping
arithescientist
commited on
Commit
•
e9536eb
1
Parent(s):
24b60d3
Update app.py
Browse files
app.py
CHANGED
@@ -28,20 +28,25 @@ custom_model = AutoModel.from_pretrained(model_name, config=custom_config)
|
|
28 |
bert_legal_model = Summarizer(custom_model=custom_model, custom_tokenizer=custom_tokenizer)
|
29 |
from zipfile import ZipFile
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
# path = folder_name
|
40 |
|
41 |
# return path
|
42 |
#pageObject.extractText()
|
43 |
-
iface = gr.Interface(fn =
|
44 |
-
inputs = "file", outputs="
|
45 |
|
46 |
if __name__ == "__main__":
|
47 |
iface.launch(share=True)
|
|
|
28 |
bert_legal_model = Summarizer(custom_model=custom_model, custom_tokenizer=custom_tokenizer)
|
29 |
from zipfile import ZipFile
|
30 |
|
31 |
+
from gtts import gTTS
|
32 |
+
from pdfminer.high_level import extract_text
|
33 |
+
|
34 |
+
def pdf_to_text(file_obj):
|
35 |
+
text = extract_text(file_obj.name)
|
36 |
+
|
37 |
+
|
38 |
+
myobj = gTTS(text=text, lang='en', slow=False)
|
39 |
+
myobj.save("test.wav")
|
40 |
+
return 'test.wav'
|
41 |
+
|
42 |
+
|
43 |
|
44 |
# path = folder_name
|
45 |
|
46 |
# return path
|
47 |
#pageObject.extractText()
|
48 |
+
iface = gr.Interface(fn = pdf_to_text,
|
49 |
+
inputs = "file", outputs="audio" )
|
50 |
|
51 |
if __name__ == "__main__":
|
52 |
iface.launch(share=True)
|