jaimin commited on
Commit
d30b29d
·
1 Parent(s): 4eb3a49

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -15
app.py CHANGED
@@ -32,7 +32,6 @@ def opendomain(text,wikipedia_language="en"):
32
  linked_pages = et_page.links
33
 
34
  text = content
35
- print(type(text))
36
  wordcloud = WordCloud(font_path="HelveticaWorld-Regular.ttf").generate(text)
37
 
38
  plt.imshow(wordcloud, interpolation='bilinear')
@@ -41,28 +40,26 @@ def opendomain(text,wikipedia_language="en"):
41
 
42
  final_out = re.sub(r'\=.+\=', '', text)
43
  result = list(filter(lambda x: x != '', final_out.split('\n\n')))
44
-
45
  answer = []
46
- for i in range(6):
47
  if len(result[i]) > 500:
 
48
  summary_point=result[i].split(".")[0]
49
  answer.append(summary_point)
50
- l = []
51
- for i in range(len(answer)):
52
- l.append("".join(answer[i]))
53
- gen_output = []
54
- for i in range(len(l)):
55
- gen_output.append("* " + l[i] + ".")
56
- paraphrase = "\n".join(gen_output)
57
- final_answer = paraphrase.replace(" ", " ")
58
- return final_answer
59
 
60
-
61
- iface = gr.Interface(fn=opendomain, inputs=[gr.inputs.Textbox(lines=5)], outputs="text")
62
- iface.launch()
 
 
 
 
63
 
64
 
 
65
 
66
 
67
 
 
 
68
 
 
32
  linked_pages = et_page.links
33
 
34
  text = content
 
35
  wordcloud = WordCloud(font_path="HelveticaWorld-Regular.ttf").generate(text)
36
 
37
  plt.imshow(wordcloud, interpolation='bilinear')
 
40
 
41
  final_out = re.sub(r'\=.+\=', '', text)
42
  result = list(filter(lambda x: x != '', final_out.split('\n\n')))
 
43
  answer = []
44
+ for i in range(len(result)):
45
  if len(result[i]) > 500:
46
+ print(len(result[i]))
47
  summary_point=result[i].split(".")[0]
48
  answer.append(summary_point)
 
 
 
 
 
 
 
 
 
49
 
50
+ rem_new_line = [] # list for without \n
51
+ for i in answer:
52
+ rem_new_line.append(i.replace("\n", ""))
53
+ gen_output = []
54
+ for i in range(len(rem_new_line)):
55
+ gen_output.append("* " + rem_new_line[i] + ".")
56
+ final_output = "\n\n".join(gen_output)
57
 
58
 
59
+ return final_output
60
 
61
 
62
 
63
+ iface = gr.Interface(fn=opendomain, inputs=[gr.inputs.Textbox(lines=5)], outputs="text")
64
+ iface.launch()
65