13ze commited on
Commit
acf83b2
verified
1 Parent(s): 5e18683

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -15,16 +15,16 @@ def main_fn(html: str, check: list[int]):
15
  for t in soup.find_all(tag):
16
  t.decompose()
17
 
 
18
  body = soup.find("body")
19
  main = soup.find("main")
 
20
 
21
- strip_tags = [] # Futuramente pode-se usar `check` para filtrar tags
22
 
23
- if main:
24
- markdown = md(main, strip=strip_tags)
25
- else:
26
- markdown = md(body, strip=strip_tags)
27
 
 
28
  title_tag = soup.find("title")
29
  title = title_tag.get_text(strip=True) if title_tag else "Sem t铆tulo"
30
 
@@ -49,7 +49,7 @@ demo = gr.Interface(
49
  outputs=[
50
  gr.TextArea(label="Markdown gerado", show_copy_button=True)
51
  ],
52
- allow_flagging="never",
53
  )
54
 
55
  demo.launch(server_name="0.0.0.0")
 
15
  for t in soup.find_all(tag):
16
  t.decompose()
17
 
18
+ # Tenta usar <main>, depois <body>, ou como fallback o pr贸prio soup
19
  body = soup.find("body")
20
  main = soup.find("main")
21
+ target = main or body or soup
22
 
23
+ strip_tags = [] # Pode usar `check` no futuro se quiser ignorar certas tags
24
 
25
+ markdown = md(target, strip=strip_tags)
 
 
 
26
 
27
+ # Tenta extrair o t铆tulo da p谩gina
28
  title_tag = soup.find("title")
29
  title = title_tag.get_text(strip=True) if title_tag else "Sem t铆tulo"
30
 
 
49
  outputs=[
50
  gr.TextArea(label="Markdown gerado", show_copy_button=True)
51
  ],
52
+ flagging_mode="never",
53
  )
54
 
55
  demo.launch(server_name="0.0.0.0")