amielle's picture
chore: Update models with paper and code sources
24df5eb
raw
history blame
3.25 kB
import gradio as gr
from util import summarizer, textproc
from util.examples import entries
model_collection = summarizer.init_models()
patent_summarizer = summarizer.PatentSummarizer(model_collection)
iface = gr.Interface(
patent_summarizer.pipeline,
theme="huggingface",
examples=entries,
examples_per_page=4,
inputs=[
gr.inputs.Textbox(label="Patent Information",
placeholder="US9820315B2 or https://patents.google.com/patent/US9820315B2 ...",
lines=1,
default="US9820315B2"),
gr.inputs.CheckboxGroup(summarizer.summary_options,
default=summarizer.summary_options,
label="Summaries to Generate"),
gr.inputs.Dropdown(summarizer.model_names,
default=summarizer.model_names[3],
label="Abstract Model"),
gr.inputs.Dropdown(summarizer.model_names,
default=summarizer.model_names[0],
label="Background Model"),
gr.inputs.Dropdown(summarizer.model_names,
default=summarizer.model_names[2],
label="Claims Model"),
gr.inputs.Checkbox(default=True,
label="Collate Claims",
optional=False),
gr.inputs.Slider(minimum=250,
maximum=1000,
step=10,
default=250,
label="Input Document Word Limit"),
],
outputs=[
gr.outputs.Textbox(label="Abstract Summary"),
gr.outputs.Textbox(label="Background Summary"),
gr.outputs.Textbox(label="Sample Claims Summary")
],
title="Patent Summarizer πŸ“–",
description="""
v.1.0.0
Reading through patent documents is oftentimes a long and tedious task.
There are cases wherein one has to manually go through several pages
in order to determine if the patent is relevant to the prior art search.
This application is meant to automate the initial phase of going through
patents so that the potential inventor or researcher may lessen the time
spent trying to filter documents.
The Patent Summarizer:
✏️ Provides an interface for user input
πŸ“‚ Retrieves and parses the document based on the given patent information
πŸ“‘ Returns summaries for the abstract, background, and/or claims.
Models explored:
- Big Bird: Transformers for Longer Sequences
https://arxiv.org/abs/2007.14062
https://huggingface.co/google/bigbird-pegasus-large-bigpatent
- T5
https://arxiv.org/pdf/1910.10683.pdf
https://huggingface.co/cnicu/t5-small-booksum
- BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension
https://arxiv.org/abs/1910.13461
https://huggingface.co/sshleifer/distilbart-cnn-6-6
- PEGASUS: Pre-training with Extracted Gap-sentences for Abstractive Summarization
https://arxiv.org/abs/1912.08777
https://huggingface.co/google/pegasus-xsum
"""
)
iface.launch()