File size: 1,951 Bytes
e6d0f4c
 
 
8fffcf8
 
 
 
 
 
 
32027d2
9c9d2b1
 
 
 
e6d0f4c
 
 
 
 
 
 
 
 
 
 
 
9c9d2b1
438eb58
e6d0f4c
 
9c9d2b1
 
 
fa8e996
 
 
 
e6d0f4c
 
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
import gradio as gr
from summarizer import summarize

description = """
<center>
SAR (सार) in Hindi means summary, It's a tool to summarize Hindi News with SOTA models
</center>
"""
article="<p style='text-align: center'> Created by Pawan Trivedi 2022 | <a href='https://github.com/d0r1h/SAR/'>GitHub</a></p>"

link1 = "https://www.amarujala.com/uttar-pradesh/shamli/up-news-heroin-caught-in-shaheen-bagh-of-delhi-is-connection-to-kairana-and-muzaffarnagar?src=tlh&position=3"

link2 = "https://www.amarujala.com/lucknow/now-the-government-will-go-to-village-to-buy-wheat-in-up-and-wheat-will-also-be-purchased-from-mobile-purchasing-centers"

link3 = "https://www.amarujala.com/india-news/supreme-court-cannot-give-the-status-of-place-of-namaz-without-evidence-rajasthan-waqf-board-s-petition-challenging-the-high-court-order-dismissed?pageId=1"

with open("Example/File.txt", 'r',  encoding="utf8") as f:
    text = f.read()


interface = gr.Interface(fn = summarize,
                        inputs = [gr.inputs.Textbox(lines=5,
                                                    placeholder="Enter your text...",
                                                    label='News Input'),
                                  gr.inputs.Radio(["T5", "BART"], type="value", label='Model')
                                  ],
                          
                        outputs = [gr.outputs.Textbox(label="Sar"), 
                                   gr.outputs.Image(type="plot", label="WordCloud")],
                         
                        title = "Hindi News Summarizer",
                        examples=[[link1, "BART"], 
                                  [link2, "BART"], 
                                  [link3, "BART"], 
                                  [text, "BART"]],
                            
                        description=description,
                        article = article)

interface.launch(debug=True)