Update app.py
Browse files
app.py
CHANGED
@@ -6,17 +6,10 @@ import matplotlib.pyplot as plt
|
|
6 |
from collections import Counter
|
7 |
import gradio as gr
|
8 |
|
9 |
-
|
10 |
-
def replace(string, char):
|
11 |
-
pattern = char + '{2,}'
|
12 |
-
string = re.sub(pattern, char, string)
|
13 |
-
return string
|
14 |
|
15 |
def create_wc(text, lang, custom_sw, input_img, color_rgb):
|
16 |
STOPWORDS = set(get_stop_words(lang))
|
17 |
STOPWORDS.update(custom_sw.replace(" ", "").split(","))
|
18 |
-
text = replace(text, "o")
|
19 |
-
text = replace(text, "a")
|
20 |
mask = np.array(input_img)
|
21 |
wordcloud = WordCloud(background_color="rgba(0, 0, 0, 0)", mode="RGBA",mask=mask, width=1000, height=1500, stopwords=STOPWORDS).generate(text.lower())
|
22 |
# wordcloud.recolor(colormap=colormap)
|
|
|
6 |
from collections import Counter
|
7 |
import gradio as gr
|
8 |
|
|
|
|
|
|
|
|
|
|
|
9 |
|
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 |
mask = np.array(input_img)
|
14 |
wordcloud = WordCloud(background_color="rgba(0, 0, 0, 0)", mode="RGBA",mask=mask, width=1000, height=1500, stopwords=STOPWORDS).generate(text.lower())
|
15 |
# wordcloud.recolor(colormap=colormap)
|