Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,6 +29,7 @@ from nltk.probability import FreqDist
|
|
| 29 |
from cleantext import clean
|
| 30 |
import textract
|
| 31 |
|
|
|
|
| 32 |
import nltk.corpus
|
| 33 |
from nltk.text import Text
|
| 34 |
from io import StringIO
|
|
@@ -172,8 +173,12 @@ def getAnalysis(score):
|
|
| 172 |
else:
|
| 173 |
return 'Positive'
|
| 174 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 175 |
|
| 176 |
-
os.system('mkdir temp')
|
| 177 |
def analysis(Manifesto,Search):
|
| 178 |
raw_party = Parsing(Manifesto)
|
| 179 |
text_Party=clean_text(raw_party)
|
|
@@ -228,7 +233,7 @@ plot2=gr.outputs.Image(label='Word Cloud')
|
|
| 228 |
plot3=gr.outputs.Image(label='Subjectivity')
|
| 229 |
plot4=gr.outputs.Image(label='Frequency Distribution')
|
| 230 |
|
| 231 |
-
io=gr.Interface(fn=analysis, inputs=[filePdf,Search_txt], outputs=[text,mfw,plot4,plot1,plot2,plot3], title='Manifesto Analysis',examples=[['
|
| 232 |
io.launch(debug=False,share=True)
|
| 233 |
|
| 234 |
|
|
|
|
| 29 |
from cleantext import clean
|
| 30 |
import textract
|
| 31 |
|
| 32 |
+
import urllib.request
|
| 33 |
import nltk.corpus
|
| 34 |
from nltk.text import Text
|
| 35 |
from io import StringIO
|
|
|
|
| 173 |
else:
|
| 174 |
return 'Positive'
|
| 175 |
|
| 176 |
+
#http://library.bjp.org/jspui/bitstream/123456789/2988/1/BJP-Election-english-2019.pdf
|
| 177 |
+
url = "http://library.bjp.org/jspui/bitstream/123456789/2988/1/BJP-Election-english-2019.pdf"
|
| 178 |
+
path_input = "./Bjp_Manifesto_2019.pdf'"
|
| 179 |
+
urllib.request.urlretrieve(url, filename=path_input)
|
| 180 |
+
|
| 181 |
|
|
|
|
| 182 |
def analysis(Manifesto,Search):
|
| 183 |
raw_party = Parsing(Manifesto)
|
| 184 |
text_Party=clean_text(raw_party)
|
|
|
|
| 233 |
plot3=gr.outputs.Image(label='Subjectivity')
|
| 234 |
plot4=gr.outputs.Image(label='Frequency Distribution')
|
| 235 |
|
| 236 |
+
io=gr.Interface(fn=analysis, inputs=[filePdf,Search_txt], outputs=[text,mfw,plot4,plot1,plot2,plot3], title='Manifesto Analysis',examples=[['./Bjp_Manifesto_2019.pdf',],)
|
| 237 |
io.launch(debug=False,share=True)
|
| 238 |
|
| 239 |
|