abdulmatinomotoso commited on
Commit
ccf8d4b
1 Parent(s): bdde448

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -17,9 +17,8 @@ def read_in_text(url):
17
  tmp_model = SentenceTransformer('valurank/MiniLM-L6-Keyword-Extraction')
18
  kw_extractor = KeyBERT(tmp_model)
19
 
20
- def get_keybert_results_with_vectorizer(file, number_of_results=20):
21
  try:
22
- text = read_in_text(file.name)
23
  keywords = kw_extractor.extract_keywords(text, vectorizer=KeyphraseCountVectorizer(), stop_words=None, top_n=number_of_results)
24
  keywords = [i for i in keywords if i[1] > 0.20]
25
 
@@ -33,7 +32,7 @@ def get_keybert_results_with_vectorizer(file, number_of_results=20):
33
  except Exception:
34
  return "Error"
35
 
36
- demo = gr.Interface(get_keybert_results_with_vectorizer, inputs=gr.inputs.File(),
37
  outputs=gr.outputs.Dataframe(),
38
  title = "Keyword Extraction")
39
 
 
17
  tmp_model = SentenceTransformer('valurank/MiniLM-L6-Keyword-Extraction')
18
  kw_extractor = KeyBERT(tmp_model)
19
 
20
+ def get_keybert_results_with_vectorizer(text, number_of_results=20):
21
  try:
 
22
  keywords = kw_extractor.extract_keywords(text, vectorizer=KeyphraseCountVectorizer(), stop_words=None, top_n=number_of_results)
23
  keywords = [i for i in keywords if i[1] > 0.20]
24
 
 
32
  except Exception:
33
  return "Error"
34
 
35
+ demo = gr.Interface(get_keybert_results_with_vectorizer, inputs=gr.inputs.Textbox(),
36
  outputs=gr.outputs.Dataframe(),
37
  title = "Keyword Extraction")
38