File size: 3,006 Bytes
5f2c1c3
 
 
48f0f78
 
5f2c1c3
 
48f0f78
 
5f2c1c3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48f0f78
 
672c196
5f2c1c3
 
 
 
 
 
 
 
 
 
48f0f78
5f2c1c3
3c576d2
5f2c1c3
 
 
 
 
48f0f78
5f2c1c3
3c576d2
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
48
49
50
51
52
53
54
55
56
57
import gradio as gr
from main import main

def rexplore_summarizer(url, id, access_key):
    response = main(url, id, access_key)
    return response, response['summary'], response['mindmap']

def clear_everything(url, id, access_key, raw_data, summary, mindmap):
    return None, None, None, None, None, None

theme = gr.themes.Soft(
    primary_hue="purple",
    secondary_hue="cyan",
    neutral_hue="slate",
    font=[
        gr.themes.GoogleFont('Syne'), 
        gr.themes.GoogleFont('Poppins'), 
        gr.themes.GoogleFont('Poppins'), 
        gr.themes.GoogleFont('Poppins')
    ],
)

with gr.Blocks(theme=theme, title="ReXplore Summarizer", fill_height=True) as app:
    gr.HTML(
        value ='''
        <h1 style="text-align: center;">ReXplore Summarizer <p style="text-align: center;">Designed and Developed by <a href='https://raannakasturi.eu.org' target="_blank" rel="nofollow noreferrer external">Nayan Kasturi</a></p> </h1>
        <p style="text-align: center;">This app uses a hybrid approach to summarize PDF documents based on CPU as well as GPU.</p>
        <p style="text-align: center;">The app uses traditional methodologies such as TextRank, LSA, Luhn algorithms as well as large language model (LLM) to generate summaries as well as mindmaps.</p>
        <p style="text-align: center;">The summarization process can take some time depending on the size of the text corpus and the complexity of the content.</p>
        ''')
    with gr.Row():
        with gr.Column():
            url = gr.Textbox(label="PDF URL", placeholder="Paste the PDF URL here")
            id = gr.Textbox(label="DOI/arXiv ID", placeholder="Enter the DOI or arXiv ID of the document")
            access_key = gr.Textbox(label="Access Key", placeholder="Enter the Access Key", type='password')
            with gr.Row():
                clear_btn = gr.Button(value="Clear", variant='stop')
                summarize_btn = gr.Button(value="Summarize", variant='primary')
        raw_data = gr.TextArea(label="Raw Data", placeholder="The generated raw data will be displayed here", lines=7, interactive=False, show_copy_button=True)
    with gr.Row():
        summary = gr.TextArea(label="Summary", placeholder="The generated summary will be displayed here", lines=7, interactive=False, show_copy_button=True)
        mindmap = gr.TextArea(label="Mindmap", placeholder="The generated mindmap will be displayed here", lines=7, interactive=False, show_copy_button=True)

    summarize_btn.click(
        rexplore_summarizer,
        inputs=[url, id, access_key],
        outputs=[raw_data, summary, mindmap],
        concurrency_limit=25,
        scroll_to_output=True,
        show_api=True,
        api_name="rexplore_summarizer",
        show_progress="full",
    )
    clear_btn.click(clear_everything, inputs=[url, id, raw_data, summary, mindmap, access_key], outputs=[url, id, raw_data, summary, mindmap, access_key], show_api=False)

app.queue(default_concurrency_limit=25).launch(show_api=True)