SOTA-Summary / app.py
awacke1's picture
Update app.py
bf1f023
raw
history blame
3.39 kB
from transformers import pipeline
import gradio as gr
from gradio.mix import Parallel, Series
io1 = gr.Interface.load('huggingface/sshleifer/distilbart-cnn-12-6')
io2 = gr.Interface.load("huggingface/facebook/bart-large-cnn")
#io3 = gr.Interface.load("huggingface/google/pegasus-xsum")
#io3 = gr.Interface.load("huggingface/emilyalsentzer/Bio_Discharge_Summary_BERT")
io3 = gr.Interface.load("huggingface/google/pegasus-pubmed")
desc = "Summary NLP Model Tour 2022. Length of text and model size influence response time. Often but not always there is a trade off with accuracy for domain specific NLP and NLU."
x = """Billions of people can live much longer and much healthier lives. As death drifts farther into the distance how will our search for meaning change as we reduce the health effects of aging as a disease? Does meaning require death or does it merely require struggle of reprogramming our biology? It will require us to delve deeper into understanding the human mind and the AI mind. Do your best to make humanity the best it can be. That is who I am and that is how I live. It is what i get up in the morning to do. I believe love is leaving the world a better place and helping others be the best they can be. Is it possible to bring back people that mean something to us personally? Not just brilliant scientists like Einstein and Johnny Von Neumann but also people that we've lost. Is there a way to achieve a kind of small artificial immortality? Where you are against others in your age group as in terms of health and longevity by your age is called your inner age. You are biologically based on what we call the epigenetic clock. We know that smoking increases the speed of that clock. We also know that fasting and people who eat the right foods have a slower clock. Without that knowledge you're flying blind.
"""
y = '''Topic identification, interpretation, summary generation, and evaluation of the generated summary are the key challenges in text summarization. Critical tasks in extraction-based summarization are identifying key phrases in the document and using them to select sentences in the document for inclusion in the summary.
In contrast, abstraction-based methods paraphrase sections of the source document.
Extraction-based summarizers perform capturing key aspects of text and storing as an intermediate representation. Scoring words, utterances and sentences in text is based on that representation. Composing a summary by selecting across a range of words improves accuracy.'''
z = '''Nine trends explain innovations in machine learning technologies benefit you and your business in 2022. These include: No-Code Machine Learning, Cognitive AI, NLP Match Language Modeling, TinyML, AutoML, Machine Learning Operationalization Management, Full-stack Deep Learning, Generative Adversarial Networks, Unsupervised ML, and finally Reinforcement Learning.
'''
sample = [[y],[x],[z]]
iface = Parallel(io1, io2, io3,
theme='huggingface',
title= 'State of the Art Text Summary',
description = desc,
examples=sample, #"sample" is a directory which lets gradio scan through files and give you the text
inputs = gr.inputs.Textbox(lines = 10, label="Text"))
iface.launch(inline = False)