Omnibus commited on
Commit
4551e44
1 Parent(s): 9fe62de

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -23,6 +23,7 @@ def find_all(url,q=None,num=None):
23
 
24
  def find_it(url,q=None,num=None):
25
  out = []
 
26
  z=""
27
  source = urllib.request.urlopen(url).read()
28
  soup = bs4.BeautifulSoup(source,'lxml')
@@ -39,6 +40,7 @@ def find_it(url,q=None,num=None):
39
  print (e)
40
  #out.append(p)
41
  out.append([{q:p.string,"additional":z,"parent":p.parent.name,"previous":[b for b in p.previous],"first-child":[b.name for b in p.children],"content":p}])
 
42
  #out.append(p.parent.name)
43
  print(dir(p))
44
  print(p.parent.name)
@@ -46,7 +48,7 @@ def find_it(url,q=None,num=None):
46
  print(url.get('href'))
47
 
48
  #print(soup.get_text())
49
- return out
50
 
51
  def find_it2(url):
52
  response = requests.get(url,a1=None,q2=None,q3=None)
@@ -71,9 +73,10 @@ with gr.Blocks() as app:
71
  with gr.Row():
72
  rawp = gr.JSON()
73
  outp = gr.JSON()
 
74
 
75
  all_btn.click(find_all,[inp,q,num],[rawp])
76
- find_btn.click(find_it,[inp,q,num],[outp])
77
 
78
  app.launch()
79
 
 
23
 
24
  def find_it(url,q=None,num=None):
25
  out = []
26
+ out_l = []
27
  z=""
28
  source = urllib.request.urlopen(url).read()
29
  soup = bs4.BeautifulSoup(source,'lxml')
 
40
  print (e)
41
  #out.append(p)
42
  out.append([{q:p.string,"additional":z,"parent":p.parent.name,"previous":[b for b in p.previous],"first-child":[b.name for b in p.children],"content":p}])
43
+ out_l.append(p.string)
44
  #out.append(p.parent.name)
45
  print(dir(p))
46
  print(p.parent.name)
 
48
  print(url.get('href'))
49
 
50
  #print(soup.get_text())
51
+ return out,out_l
52
 
53
  def find_it2(url):
54
  response = requests.get(url,a1=None,q2=None,q3=None)
 
73
  with gr.Row():
74
  rawp = gr.JSON()
75
  outp = gr.JSON()
76
+ outl = gr.Textbox()
77
 
78
  all_btn.click(find_all,[inp,q,num],[rawp])
79
+ find_btn.click(find_it,[inp,q,num],[outp,outl])
80
 
81
  app.launch()
82