Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -277,9 +277,9 @@ def word_cloud_generator(parsed_text_name,text_Party):
|
|
277 |
parsed=parsed_text_name.lower()
|
278 |
|
279 |
if 'bjp' in parsed:
|
280 |
-
orgImg=Original_Image('
|
281 |
-
bwImg=Image_Processed('
|
282 |
-
plt.figure(figsize=(
|
283 |
wordCloud(orgImg,bwImg,text_Party,maxWord=3000,colorGener=True,contCol='white',bckColor='black')
|
284 |
|
285 |
plt.tight_layout()
|
@@ -294,7 +294,7 @@ def word_cloud_generator(parsed_text_name,text_Party):
|
|
294 |
elif 'congress' in parsed:
|
295 |
orgImg=Original_Image('congress3.jpeg')
|
296 |
bwImg=Image_Processed('congress3.jpeg')
|
297 |
-
plt.figure(figsize=(
|
298 |
wordCloud(orgImg,bwImg,text_Party,maxWord=3000,colorGener=True)
|
299 |
|
300 |
plt.tight_layout()
|
@@ -310,7 +310,7 @@ def word_cloud_generator(parsed_text_name,text_Party):
|
|
310 |
elif 'aap' in parsed:
|
311 |
orgImg=Original_Image('aapMain2.jpg')
|
312 |
bwImg=Image_Processed('aapMain2.jpg')
|
313 |
-
plt.figure(figsize=(
|
314 |
wordCloud(orgImg,bwImg,text_Party,maxWord=3000,colorGener=False,contCol='black')
|
315 |
|
316 |
plt.tight_layout()
|
@@ -391,7 +391,7 @@ def analysis(Manifesto,Search):
|
|
391 |
searChRes=searChRes.replace(Search,"\u0332".join(Search))
|
392 |
return searChRes,fdist_Party,img1,img2,img3,img4,img5
|
393 |
|
394 |
-
|
395 |
Search_txt=gr.inputs.Textbox()
|
396 |
filePdf = gr.inputs.File()
|
397 |
text = gr.outputs.Textbox(label='Context Based Search')
|
@@ -404,7 +404,7 @@ plot5=gr.outputs.Image(label='Dispersion Plot')
|
|
404 |
|
405 |
io=gr.Interface(fn=analysis, inputs=[filePdf,Search_txt], outputs=[text,mfw,plot1,plot2,plot3,plot4,plot5], title='Manifesto Analysis',examples=[['Example/Bjp_Manifesto_2019.pdf','modi'],['Example/AAP_Manifesto_2019.pdf','government'],['Example/Congress_Manifesto_2019.pdf','safety']],theme='peach')
|
406 |
io.launch(debug=True,share=False)
|
407 |
-
|
408 |
#,examples=[['./Bjp_Manifesto_2019.pdf','india'],['./AAP_Manifesto_2019.pdf',],['./Congress_Manifesto_2019.pdf',]]
|
409 |
#allow_screenshot=False, allow_flagging="never",
|
410 |
|
|
|
277 |
parsed=parsed_text_name.lower()
|
278 |
|
279 |
if 'bjp' in parsed:
|
280 |
+
orgImg=Original_Image('BJPMain.jpg')
|
281 |
+
bwImg=Image_Processed('BJPMain.jpg')
|
282 |
+
plt.figure(figsize=(5,3))
|
283 |
wordCloud(orgImg,bwImg,text_Party,maxWord=3000,colorGener=True,contCol='white',bckColor='black')
|
284 |
|
285 |
plt.tight_layout()
|
|
|
294 |
elif 'congress' in parsed:
|
295 |
orgImg=Original_Image('congress3.jpeg')
|
296 |
bwImg=Image_Processed('congress3.jpeg')
|
297 |
+
plt.figure(figsize=(5,3))
|
298 |
wordCloud(orgImg,bwImg,text_Party,maxWord=3000,colorGener=True)
|
299 |
|
300 |
plt.tight_layout()
|
|
|
310 |
elif 'aap' in parsed:
|
311 |
orgImg=Original_Image('aapMain2.jpg')
|
312 |
bwImg=Image_Processed('aapMain2.jpg')
|
313 |
+
plt.figure(figsize=(5,3))
|
314 |
wordCloud(orgImg,bwImg,text_Party,maxWord=3000,colorGener=False,contCol='black')
|
315 |
|
316 |
plt.tight_layout()
|
|
|
391 |
searChRes=searChRes.replace(Search,"\u0332".join(Search))
|
392 |
return searChRes,fdist_Party,img1,img2,img3,img4,img5
|
393 |
|
394 |
+
plt.close('all')
|
395 |
Search_txt=gr.inputs.Textbox()
|
396 |
filePdf = gr.inputs.File()
|
397 |
text = gr.outputs.Textbox(label='Context Based Search')
|
|
|
404 |
|
405 |
io=gr.Interface(fn=analysis, inputs=[filePdf,Search_txt], outputs=[text,mfw,plot1,plot2,plot3,plot4,plot5], title='Manifesto Analysis',examples=[['Example/Bjp_Manifesto_2019.pdf','modi'],['Example/AAP_Manifesto_2019.pdf','government'],['Example/Congress_Manifesto_2019.pdf','safety']],theme='peach')
|
406 |
io.launch(debug=True,share=False)
|
407 |
+
|
408 |
#,examples=[['./Bjp_Manifesto_2019.pdf','india'],['./AAP_Manifesto_2019.pdf',],['./Congress_Manifesto_2019.pdf',]]
|
409 |
#allow_screenshot=False, allow_flagging="never",
|
410 |
|