Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -225,13 +225,13 @@ def wordCloud(orgIm,mask_img,text_Party_pr,maxWord=2000,colorGener=True,contCol=
|
|
| 225 |
mask=mask,
|
| 226 |
colormap='nipy_spectral_r',
|
| 227 |
contour_color=contCol,
|
| 228 |
-
width=
|
| 229 |
margin=2,
|
| 230 |
contour_width=3).generate(text_Party_pr)
|
| 231 |
|
| 232 |
# create coloring from image
|
| 233 |
|
| 234 |
-
|
| 235 |
|
| 236 |
if colorGener==True:
|
| 237 |
image_colors = ImageColorGenerator(orgIm)
|
|
@@ -240,7 +240,8 @@ def wordCloud(orgIm,mask_img,text_Party_pr,maxWord=2000,colorGener=True,contCol=
|
|
| 240 |
|
| 241 |
else:
|
| 242 |
plt.imshow(wordcloud)
|
| 243 |
-
|
|
|
|
| 244 |
plt.axis("off")
|
| 245 |
|
| 246 |
def word_cloud_generator(parsed_text_name,text_Party):
|
|
@@ -252,6 +253,7 @@ def word_cloud_generator(parsed_text_name,text_Party):
|
|
| 252 |
wordCloud(orgImg,bwImg,text_Party,maxWord=3000,colorGener=True,contCol='white',bckColor='black')
|
| 253 |
plt.tight_layout()
|
| 254 |
buf = BytesIO()
|
|
|
|
| 255 |
plt.savefig(buf)
|
| 256 |
buf.seek(0)
|
| 257 |
img1 = Image.open(buf)
|
|
@@ -266,6 +268,7 @@ def word_cloud_generator(parsed_text_name,text_Party):
|
|
| 266 |
wordCloud(orgImg,bwImg,text_Party,maxWord=3000,colorGener=True)
|
| 267 |
plt.tight_layout()
|
| 268 |
buf = BytesIO()
|
|
|
|
| 269 |
plt.savefig(buf)
|
| 270 |
buf.seek(0)
|
| 271 |
img2 = Image.open(buf)
|
|
@@ -279,6 +282,7 @@ def word_cloud_generator(parsed_text_name,text_Party):
|
|
| 279 |
wordCloud(orgImg,bwImg,text_Party,maxWord=3000,colorGener=False,contCol='black')
|
| 280 |
plt.tight_layout()
|
| 281 |
buf = BytesIO()
|
|
|
|
| 282 |
plt.savefig(buf)
|
| 283 |
buf.seek(0)
|
| 284 |
img3 = Image.open(buf)
|
|
@@ -292,6 +296,7 @@ def word_cloud_generator(parsed_text_name,text_Party):
|
|
| 292 |
plt.axis("off")
|
| 293 |
plt.tight_layout()
|
| 294 |
buf = BytesIO()
|
|
|
|
| 295 |
plt.savefig(buf)
|
| 296 |
buf.seek(0)
|
| 297 |
img4 = Image.open(buf)
|
|
|
|
| 225 |
mask=mask,
|
| 226 |
colormap='nipy_spectral_r',
|
| 227 |
contour_color=contCol,
|
| 228 |
+
width=800, height=800,
|
| 229 |
margin=2,
|
| 230 |
contour_width=3).generate(text_Party_pr)
|
| 231 |
|
| 232 |
# create coloring from image
|
| 233 |
|
| 234 |
+
|
| 235 |
|
| 236 |
if colorGener==True:
|
| 237 |
image_colors = ImageColorGenerator(orgIm)
|
|
|
|
| 240 |
|
| 241 |
else:
|
| 242 |
plt.imshow(wordcloud)
|
| 243 |
+
|
| 244 |
+
plt.figure(figsize=[15,12])
|
| 245 |
plt.axis("off")
|
| 246 |
|
| 247 |
def word_cloud_generator(parsed_text_name,text_Party):
|
|
|
|
| 253 |
wordCloud(orgImg,bwImg,text_Party,maxWord=3000,colorGener=True,contCol='white',bckColor='black')
|
| 254 |
plt.tight_layout()
|
| 255 |
buf = BytesIO()
|
| 256 |
+
plt.figure(figsize=[15,12])
|
| 257 |
plt.savefig(buf)
|
| 258 |
buf.seek(0)
|
| 259 |
img1 = Image.open(buf)
|
|
|
|
| 268 |
wordCloud(orgImg,bwImg,text_Party,maxWord=3000,colorGener=True)
|
| 269 |
plt.tight_layout()
|
| 270 |
buf = BytesIO()
|
| 271 |
+
plt.figure(figsize=[15,12])
|
| 272 |
plt.savefig(buf)
|
| 273 |
buf.seek(0)
|
| 274 |
img2 = Image.open(buf)
|
|
|
|
| 282 |
wordCloud(orgImg,bwImg,text_Party,maxWord=3000,colorGener=False,contCol='black')
|
| 283 |
plt.tight_layout()
|
| 284 |
buf = BytesIO()
|
| 285 |
+
plt.figure(figsize=[15,12])
|
| 286 |
plt.savefig(buf)
|
| 287 |
buf.seek(0)
|
| 288 |
img3 = Image.open(buf)
|
|
|
|
| 296 |
plt.axis("off")
|
| 297 |
plt.tight_layout()
|
| 298 |
buf = BytesIO()
|
| 299 |
+
plt.figure(figsize=[15,12])
|
| 300 |
plt.savefig(buf)
|
| 301 |
buf.seek(0)
|
| 302 |
img4 = Image.open(buf)
|