text-keywords / app.py
vinni1484's picture
Update app.py
39c0fbb
raw
history blame contribute delete
358 Bytes
import gradio as gr
from keybert import KeyBERT
model = KeyBERT("sentence-transformers/xlm-r-distilroberta-base-paraphrase-v1")
def keywords(text):
keywords = model.extract_keywords(text, keyphrase_ngram_range=(1,2), top_n=10)
keywords = dict(keywords)
return keywords
gr.Interface(keywords, "text", "text", title="Keyword Extractor").launch()