Update app.py
Browse files
app.py
CHANGED
@@ -10,10 +10,10 @@ import gradio as gr
|
|
10 |
def create_wc(text, lang, custom_sw, input_img, color_rgb):
|
11 |
STOPWORDS = set(get_stop_words(lang))
|
12 |
STOPWORDS.update(custom_sw.replace(" ", "").split(","))
|
13 |
-
|
14 |
-
|
15 |
mask = np.array(input_img)
|
16 |
-
text_dict = Counter(
|
17 |
wordcloud = WordCloud(background_color="rgba(0, 0, 0, 0)", mode="RGBA",mask=mask, width=1000, height=1500, stopwords=STOPWORDS).generate_from_frequencies(text_dict)
|
18 |
# wordcloud.recolor(colormap=colormap)
|
19 |
wordcloud.recolor(color_func=get_single_color_func(f'rgb({color_rgb})'))
|
|
|
10 |
def create_wc(text, lang, custom_sw, input_img, color_rgb):
|
11 |
STOPWORDS = set(get_stop_words(lang))
|
12 |
STOPWORDS.update(custom_sw.replace(" ", "").split(","))
|
13 |
+
words = text.lower()split(" ")
|
14 |
+
words = [word for word in word_list if word not in STOPWORDS]
|
15 |
mask = np.array(input_img)
|
16 |
+
text_dict = Counter(words)
|
17 |
wordcloud = WordCloud(background_color="rgba(0, 0, 0, 0)", mode="RGBA",mask=mask, width=1000, height=1500, stopwords=STOPWORDS).generate_from_frequencies(text_dict)
|
18 |
# wordcloud.recolor(colormap=colormap)
|
19 |
wordcloud.recolor(color_func=get_single_color_func(f'rgb({color_rgb})'))
|