import gradio as gr import requests from bs4 import BeautifulSoup from markdownify import MarkdownConverter def md(soup, **options): return MarkdownConverter(**options).convert_soup(soup) def main_fn(url: str, check: list[int]): response = requests.get(url) soup = BeautifulSoup(response.text) for tag in ["script", "style"]: target = soup.find_all(tag) for t in target: t.clear body = soup.find("body") main = soup.find("main") if main: return md(main, strip=check) return md(body) demo = gr.Interface( main_fn, title="URL to Markdown", description="""