Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import os
|
2 |
import gradio as gr
|
3 |
-
from transformers import pipeline
|
4 |
import spacy
|
5 |
import lib.read_pdf
|
6 |
import pandas as pd
|
@@ -12,18 +12,6 @@ import io
|
|
12 |
nlp = spacy.load('en_core_web_sm')
|
13 |
nlp.add_pipe('sentencizer')
|
14 |
|
15 |
-
#bert_model_name = "bert-base-uncased"
|
16 |
-
#tokenizer = BertTokenizer.from_pretrained(bert_model_name)
|
17 |
-
#model = BertModel.from_pretrained(bert_model_name)
|
18 |
-
#model.eval()
|
19 |
-
|
20 |
-
#import torch
|
21 |
-
#import numpy as np
|
22 |
-
#from sklearn.metrics.pairwise import cosine_similarity
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
def split_in_sentences(text):
|
28 |
doc = nlp(text)
|
29 |
return [str(sent).strip() for sent in doc.sents]
|
@@ -242,8 +230,6 @@ with gr.Blocks() as demo:
|
|
242 |
with gr.Column():
|
243 |
gr.Markdown("### PDF 1 Analysis")
|
244 |
selected_paragraph_1 = gr.Textbox(label="Selected Paragraph 1 Content", lines=4)
|
245 |
-
#selected_paragraph_btn1 = gr.Button("Nearest paragraph content from pdf 2")
|
246 |
-
#selected_paragraph_btn1.click(fn=lambda p: compare_paragraph_to_list(p, stored_paragraphs_2), inputs=paragraph_1_dropdown, outputs=selected_paragraph_1)
|
247 |
summarize_btn1 = gr.Button("Summarize Text from PDF 1")
|
248 |
summary_textbox_1 = gr.Textbox(label="Summary for PDF 1", lines=2)
|
249 |
summarize_btn1.click(fn=lambda p: process_paragraph_1_sum(p), inputs=paragraph_1_dropdown, outputs=summary_textbox_1)
|
|
|
1 |
import os
|
2 |
import gradio as gr
|
3 |
+
from transformers import pipeline
|
4 |
import spacy
|
5 |
import lib.read_pdf
|
6 |
import pandas as pd
|
|
|
12 |
nlp = spacy.load('en_core_web_sm')
|
13 |
nlp.add_pipe('sentencizer')
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
def split_in_sentences(text):
|
16 |
doc = nlp(text)
|
17 |
return [str(sent).strip() for sent in doc.sents]
|
|
|
230 |
with gr.Column():
|
231 |
gr.Markdown("### PDF 1 Analysis")
|
232 |
selected_paragraph_1 = gr.Textbox(label="Selected Paragraph 1 Content", lines=4)
|
|
|
|
|
233 |
summarize_btn1 = gr.Button("Summarize Text from PDF 1")
|
234 |
summary_textbox_1 = gr.Textbox(label="Summary for PDF 1", lines=2)
|
235 |
summarize_btn1.click(fn=lambda p: process_paragraph_1_sum(p), inputs=paragraph_1_dropdown, outputs=summary_textbox_1)
|