Spaces:
Runtime error
Runtime error
Update app.py
Browse files105 unmodified lines1061071081091101111121 unmodified line11411511611711811912012112212319 unmodified lines143144145146147148105 unmodified linesreturn fig2, wordcloud_imagedef generate_wordcloud(entities: List[Dict], color_map: Dict[str, str]) -> np.ndarray:token_texts = []token_scores = []1 unmodified linefor entity in entities:for token in entity['tokens']:token_texts.append(token)token_scores.append(entity['score'])token_types.append(entity['entity'])print(f"{token} ({entity['entity']}): {entity['score']}")# Create a dictionary for word cloudword_freq = {text: score for text, score in zip(token_texts, token_scores)}19 unmodified linesreturn image_array@spaces.GPUdef all(text: str):ner_output_bin = process_ner(text, pipe_bin)105 unmodified lines1061071081091101111 unmodified line11311411511611711811912012112212319 unmodified lines143144145146147148149105 unmodified linesreturn fig2, wordcloud_imagedef generate_wordcloud(entities: List[Dict], color_map: Dict[str, str]) -> np.ndarray:token_texts = []token_scores = []1 unmodified linefor entity in entities:for token in entity['tokens']:cleaned_token = token.lstrip('_')token_texts.append(cleaned_token)token_scores.append(entity['score'])token_types.append(entity['entity'])print(f"{cleaned_token} ({entity['entity']}): {entity['score']}")# Create a dictionary for word cloudword_freq = {text: score for text, score in zip(token_texts, token_scores)}19 unmodified linesreturn image_array@spaces.GPUdef all(text: str):ner_output_bin = process_ner(text, pipe_bin)
app.py+4-3