File size: 817 Bytes
d197442
 
bbe5bfe
d197442
 
a9f6628
d197442
 
 
 
 
a9f6628
d197442
 
 
 
 
 
 
a9f6628
 
d197442
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from keybert import KeyBERT
import gradio as gr

# Initialize KeyBERT model
kw_model = KeyBERT()

# Define Gradio interface function
def gradio_interface(doc):
    # Use KeyBERT model to extract keywords from the input text
    keywords = kw_model.extract_keywords(doc)
    return keywords

# Set up Gradio interface
iface = gr.Interface(
    fn=gradio_interface,  # Function to process the input
    inputs=gr.Textbox(label="Document", lines=3, placeholder="Enter the document here..."),  # Textbox input for the document
    outputs="json",  # Output format (JSON to display extracted keywords)
    title="Keyword Extraction Tool v1",  # Title of the Gradio app
    description="Extracts keywords from a given document using KeyBERT."  # Description of the app
)

# Launch Gradio interface
iface.launch(share=True)