Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| #from bs4 import BeautifulSoup as bs | |
| #import html5lib | |
| #import copy | |
| import requests | |
| from IPython.display import IFrame | |
| def scrape(instring): | |
| #r = requests.get(instring) | |
| chunk_size=2000 | |
| url = f'{instring}' | |
| r = requests.get(url, stream=True) | |
| with open('/tmp/metadata.pdf', 'wb') as fd: | |
| for chunk in r.iter_content(chunk_size): | |
| fd.write(chunk) | |
| try: | |
| out = r.raw | |
| except Exception: | |
| #out=copy.copy(soup) | |
| print ("No Divs") | |
| #out = IFrame(src={instring}, width=700, height=600) | |
| return gr.HTML.update(f'''<iframe src={out}, width=700, height=600></iframe''') | |
| with gr.Blocks() as app: | |
| inp=gr.Textbox() | |
| go_btn = gr.Button() | |
| outp = gr.HTML() | |
| go_btn.click(scrape,inp,outp) | |
| app.queue(concurrency_count=10).launch() |