Add web UI for document summarization

This commit is contained in:
Mert Cobanov 2024-03-21 20:36:40 +03:00
parent c18dd8eeb5
commit f22044abf1

20
webui.py Normal file
View File

@ -0,0 +1,20 @@
import gradio as gr
from summarizer import setup_summarization_chain, load_document
def summarize(url):
docs = load_document(url)
llm_chain = setup_summarization_chain()
result = llm_chain.run(docs)
return result
iface = gr.Interface(
fn=summarize,
inputs="text",
outputs="text",
title="Summarizer",
description="Enter a URL to get a summary of the document.",
)
iface.launch()