InnaV commited on
Commit
56aca12
·
verified ·
1 Parent(s): 68f5deb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -30,6 +30,10 @@ def extract_main_topic(text: str) -> str:
30
  Returns:
31
  str: The extracted main topic as keywords.
32
  """
 
 
 
 
33
  topics, probs = topic_model.transform([text])
34
 
35
  if topic_id == -1: # BERTopic assigns -1 to noise (no topic detected)
 
30
  Returns:
31
  str: The extracted main topic as keywords.
32
  """
33
+
34
+ # Initialize BERTopic model
35
+ topic_model = BERTopic.load("MaartenGr/BERTopic_ArXiv")
36
+
37
  topics, probs = topic_model.transform([text])
38
 
39
  if topic_id == -1: # BERTopic assigns -1 to noise (no topic detected)