Spaces:
Runtime error
Runtime error
Davidsamuel101
commited on
Commit
Β·
6e82059
1
Parent(s):
fc4f441
Fix Convert2Markdown
Browse files
src/__pycache__/app.cpython-38.pyc
ADDED
Binary file (2.59 kB). View file
|
|
src/__pycache__/text_extractor.cpython-38.pyc
ADDED
Binary file (5.05 kB). View file
|
|
app.py β src/app.py
RENAMED
@@ -16,7 +16,7 @@ FILENAME = ""
|
|
16 |
preprocess = TextExtractor()
|
17 |
model_name = "sshleifer/distill-pegasus-cnn-16-4"
|
18 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
19 |
-
tokenizer = PegasusTokenizer.from_pretrained(model_name
|
20 |
model = PegasusForConditionalGeneration.from_pretrained(model_name).to(device)
|
21 |
|
22 |
def summarize(slides):
|
@@ -34,11 +34,10 @@ def summarize(slides):
|
|
34 |
print("Summarization Fails")
|
35 |
return generated_slides
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
mdFile.new_paragraph('---')
|
42 |
for section in v:
|
43 |
tag = section[0]
|
44 |
content = section[1]
|
@@ -47,7 +46,7 @@ def convert2markdown(generate_slides):
|
|
47 |
if tag == 'p':
|
48 |
contents = content.split('<n>')
|
49 |
for content in contents:
|
50 |
-
mdFile.
|
51 |
mdFile.create_md_file()
|
52 |
return f"{FILENAME}.md"
|
53 |
|
|
|
16 |
preprocess = TextExtractor()
|
17 |
model_name = "sshleifer/distill-pegasus-cnn-16-4"
|
18 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
19 |
+
tokenizer = PegasusTokenizer.from_pretrained(model_name)
|
20 |
model = PegasusForConditionalGeneration.from_pretrained(model_name).to(device)
|
21 |
|
22 |
def summarize(slides):
|
|
|
34 |
print("Summarization Fails")
|
35 |
return generated_slides
|
36 |
|
37 |
+
def convert2markdown(generated_slides):
|
38 |
+
mdFile = MdUtils(file_name=f"summary/{FILENAME}", title=f'{FILENAME} Presentation')
|
39 |
+
for k, v in generated_slides.items():
|
40 |
+
mdFile.new_line('---\n')
|
|
|
41 |
for section in v:
|
42 |
tag = section[0]
|
43 |
content = section[1]
|
|
|
46 |
if tag == 'p':
|
47 |
contents = content.split('<n>')
|
48 |
for content in contents:
|
49 |
+
mdFile.new_line(f"{content}\n")
|
50 |
mdFile.create_md_file()
|
51 |
return f"{FILENAME}.md"
|
52 |
|
text_extractor.py β src/text_extractor.py
RENAMED
File without changes
|