File size: 1,310 Bytes
0751294
17e34a5
0751294
 
 
91cbd61
 
0751294
 
 
 
 
 
 
 
 
 
 
342a4a2
0751294
 
90cc1ec
 
 
 
 
 
 
af05aa3
342a4a2
af05aa3
24b60d3
 
91cbd61
24b60d3
af05aa3
 
31e79df
af05aa3
336fd59
af05aa3
d468541
eea64fd
5a61d18
0751294
342a4a2
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#**************** IMPORT PACKAGES ********************
import gradio as gr
import numpy as np
import pytesseract as pt
import pdf2image
import os
import tempfile
from fpdf import FPDF
import re
import nltk
from nltk.tokenize import sent_tokenize
from nltk.tokenize import word_tokenize
import os
import pdfkit
import yake
from transformers import AutoTokenizer, AutoModelForPreTraining, AutoModel, AutoConfig
from summarizer import Summarizer,TransformerSummarizer
from transformers import pipelines
nltk.download('punkt')


model_name = 'nlpaueb/legal-bert-base-uncased'
# The setup of huggingface.co
custom_config = AutoConfig.from_pretrained(model_name)
custom_config.output_hidden_states=True
custom_tokenizer = AutoTokenizer.from_pretrained(model_name)
custom_model = AutoModel.from_pretrained(model_name, config=custom_config)
bert_legal_model = Summarizer(custom_model=custom_model, custom_tokenizer=custom_tokenizer)
from zipfile import ZipFile

def zip_to_json(file_obj):
   with open(file_obj, 'w') as fh:
      fh.write('<content>')
      
      return fh
     
#def pdf(file_name):
    
 #   path = folder_name
    
  #  return path 
    #pageObject.extractText() 
iface = gr.Interface(fn = zip_to_json,
   inputs =  "file", outputs="file" )

if __name__ == "__main__":
    iface.launch(share=True)