xavierbarbier commited on
Commit
9838c31
·
verified ·
1 Parent(s): c34df49

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -71,15 +71,20 @@ def extract_text(file):
71
  text = ' '.join(text)
72
 
73
  return text
74
-
75
 
 
 
 
 
 
76
 
77
  with gr.Blocks() as demo:
78
  file_input = gr.File(label="Upload a PDF file")
79
  text_output = gr.Textbox(label="Extracted Text")
80
-
81
  file_input.upload(extract_text, inputs=file_input, outputs=text_output)
 
82
 
83
- )
84
  if __name__ == "__main__":
85
  demo.queue(max_size=3).launch()
 
71
  text = ' '.join(text)
72
 
73
  return text
 
74
 
75
+ def summarise(text):
76
+
77
+ chunks = [text[i:i + chunk_size] for i in range(0, len(text), chunk_size)]
78
+
79
+ return print(len(len(chunks)))
80
 
81
  with gr.Blocks() as demo:
82
  file_input = gr.File(label="Upload a PDF file")
83
  text_output = gr.Textbox(label="Extracted Text")
84
+ summary_output = gr.Textbox(label="Summary")
85
  file_input.upload(extract_text, inputs=file_input, outputs=text_output)
86
+ text_output.change(summarise,text_output,summary_output)
87
 
88
+
89
  if __name__ == "__main__":
90
  demo.queue(max_size=3).launch()