Omnibus commited on
Commit
3919e25
·
1 Parent(s): cdf858f

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +39 -0
app.py ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ #from bs4 import BeautifulSoup as bs
3
+ #import html5lib
4
+ #import copy
5
+ import requests
6
+
7
+ def scrape(instring):
8
+
9
+ r = requests.get(instring)
10
+
11
+ #soup = bs(r.content,'html5lib')
12
+ #soup.prettify(encoding=None, formatter="minimal")
13
+ #print(soup)
14
+ #divs = soup.find_all("li")
15
+ #for dive in divs:
16
+
17
+ #mydivs = soup.find(f"{root}", {f"{trunk}": f"{branch}"})
18
+ #divs = soup.find_all("li",{"class":"ng-border-bottom-neutral-30 ng-font-neutral-60 ng-flex ng-space-between ng-pa24"})
19
+
20
+ #div data-react-class="components/OrderedList" data-react-props="
21
+ try:
22
+ out = r.content
23
+ #print(f'DIVS: {divs}')
24
+ #print (mydivs)
25
+ #out = soup.get_text()
26
+ #print ("Divs")
27
+ except Exception:
28
+ #out=copy.copy(soup)
29
+ print ("No Divs")
30
+
31
+ #out =
32
+ return out
33
+
34
+ with gr.Block() as app:
35
+ inp=gr.Textbox()
36
+ go_btn = gr.Button()
37
+ outp = gr.Textbox()
38
+ go_btn.click(scrape,inp,outp)
39
+ app.queue(concurrency_count=10).launch()