arithescientist commited on
Commit
e9536eb
1 Parent(s): 24b60d3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -9
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
- def zip_to_json(file_obj):
32
- with open(file_obj, 'w') as fh:
33
- fh.write('<content>')
34
-
35
- return fh
36
-
37
- #def pdf(file_name):
 
 
 
 
 
38
 
39
  # path = folder_name
40
 
41
  # return path
42
  #pageObject.extractText()
43
- iface = gr.Interface(fn = zip_to_json,
44
- inputs = "file", outputs="file" )
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)