Spaces:
Sleeping
Sleeping
File size: 1,736 Bytes
64af2ae 34b369f 4a10621 34b369f 4a10621 f64ef7b 4a10621 bd48583 8dbd490 733c886 8dbd490 733c886 8dbd490 733c886 8dbd490 |
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 |
import gradio as gr
from src.TextSummarizer.pipeline.prediction import PredictionPipeline
def predict(document):
"""
Method will take the document and summarize it.
"""
# predict the summary using my own pre-trained model.
summary = PredictionPipeline().predict(document)
return summary
# Create the frontend.
input_interfaces: list = []
with gr.Blocks(theme=gr.themes.Soft()) as app:
with gr.Row():
gr.Label("Text Summarizer...")
with gr.Row():
gr.Markdown("Type in your document which you wanna summarize...")
input_text_box = gr.Textbox(
label="Document",
info="Example text",
lines=20,
value="Wikipedia is a free, open content online encyclopedia created through the collaborative effort of a community of users known as Wikipedians. Anyone registered on the site can create an article for publication; registration is not required to edit articles. Jimmy Wales and Larry Sanger co-founded Wikipedia as an offshoot of an earlier encyclopedia project, Nupedia, in January 2001. Originally, Wikipedia was created to provide content for Nupedia. However, as the wiki site became established it soon grew beyond the scope of the earlier project. As of January 2015, the website provided well over five million articles in English and more than that number in all other languages combined. At that same time, Alexa ranked Wikipedia as the seventh-most popular site on the Internet. Wikipedia was the only non-commercial site of the top ten.",
)
input_interfaces.append(input_text_box)
# Add the button actions.
gr.Interface(predict,
inputs=input_interfaces,
outputs="text")
app.launch(share=True)
|