Spaces:
Runtime error
Runtime error
Commit
·
71637d2
1
Parent(s):
f262292
Update app.py
Browse files
app.py
CHANGED
@@ -25,9 +25,11 @@ def summarize(slides):
|
|
25 |
for idx, (tag, content) in enumerate(contents):
|
26 |
if tag.startswith('p'):
|
27 |
try:
|
|
|
28 |
input = tokenizer(content, truncation=True, padding="longest", return_tensors="pt").to(device)
|
29 |
tensor = model.generate(**input)
|
30 |
summary = tokenizer.batch_decode(tensor, skip_special_tokens=True)[0]
|
|
|
31 |
contents[idx] = (tag, summary)
|
32 |
except Exception as e:
|
33 |
print(e)
|
@@ -56,7 +58,6 @@ def inference(document):
|
|
56 |
global FILENAME
|
57 |
doc = fitz.open(document)
|
58 |
FILENAME = Path(doc.name).stem
|
59 |
-
print(FILENAME)
|
60 |
font_counts, styles = preprocess.get_font_info(doc, granularity=False)
|
61 |
size_tag = preprocess.get_font_tags(font_counts, styles)
|
62 |
texts = preprocess.assign_tags(doc, size_tag)
|
|
|
25 |
for idx, (tag, content) in enumerate(contents):
|
26 |
if tag.startswith('p'):
|
27 |
try:
|
28 |
+
print(f"Content: {content}")
|
29 |
input = tokenizer(content, truncation=True, padding="longest", return_tensors="pt").to(device)
|
30 |
tensor = model.generate(**input)
|
31 |
summary = tokenizer.batch_decode(tensor, skip_special_tokens=True)[0]
|
32 |
+
print(f"Summary: {summary}")
|
33 |
contents[idx] = (tag, summary)
|
34 |
except Exception as e:
|
35 |
print(e)
|
|
|
58 |
global FILENAME
|
59 |
doc = fitz.open(document)
|
60 |
FILENAME = Path(doc.name).stem
|
|
|
61 |
font_counts, styles = preprocess.get_font_info(doc, granularity=False)
|
62 |
size_tag = preprocess.get_font_tags(font_counts, styles)
|
63 |
texts = preprocess.assign_tags(doc, size_tag)
|