Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,30 +7,24 @@ from IPython.display import IFrame
|
|
| 7 |
|
| 8 |
def scrape(instring):
|
| 9 |
|
| 10 |
-
r = requests.get(instring)
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
#print(soup)
|
| 15 |
-
#divs = soup.find_all("li")
|
| 16 |
-
#for dive in divs:
|
| 17 |
-
|
| 18 |
-
#mydivs = soup.find(f"{root}", {f"{trunk}": f"{branch}"})
|
| 19 |
-
#divs = soup.find_all("li",{"class":"ng-border-bottom-neutral-30 ng-font-neutral-60 ng-flex ng-space-between ng-pa24"})
|
| 20 |
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
| 22 |
try:
|
| 23 |
-
out = r.
|
| 24 |
-
|
| 25 |
-
#print (mydivs)
|
| 26 |
-
#out = soup.get_text()
|
| 27 |
-
#print ("Divs")
|
| 28 |
except Exception:
|
| 29 |
#out=copy.copy(soup)
|
| 30 |
print ("No Divs")
|
| 31 |
|
| 32 |
-
out = IFrame(src={instring}, width=700, height=600)
|
| 33 |
-
return gr.HTML.update(f'''<iframe src={
|
| 34 |
with gr.Blocks() as app:
|
| 35 |
inp=gr.Textbox()
|
| 36 |
go_btn = gr.Button()
|
|
|
|
| 7 |
|
| 8 |
def scrape(instring):
|
| 9 |
|
| 10 |
+
#r = requests.get(instring)
|
| 11 |
+
|
| 12 |
+
url = f'{instring}'
|
| 13 |
+
r = requests.get(url, stream=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
+
with open('/tmp/metadata.pdf', 'wb') as fd:
|
| 16 |
+
for chunk in r.iter_content(chunk_size):
|
| 17 |
+
fd.write(chunk)
|
| 18 |
+
|
| 19 |
try:
|
| 20 |
+
out = r.raw
|
| 21 |
+
|
|
|
|
|
|
|
|
|
|
| 22 |
except Exception:
|
| 23 |
#out=copy.copy(soup)
|
| 24 |
print ("No Divs")
|
| 25 |
|
| 26 |
+
#out = IFrame(src={instring}, width=700, height=600)
|
| 27 |
+
return gr.HTML.update(f'''<iframe src={out}></iframe''')
|
| 28 |
with gr.Blocks() as app:
|
| 29 |
inp=gr.Textbox()
|
| 30 |
go_btn = gr.Button()
|