Spaces:
Sleeping
Sleeping
Change quiz downloads from .md to .html
Browse files- app.py +1 -1
- pages/artifacts.py +3 -1
app.py
CHANGED
|
@@ -400,7 +400,7 @@ with gr.Blocks(css=CUSTOM_CSS, theme=dark_theme, title="NotebookLM", js=BEFOREUN
|
|
| 400 |
)
|
| 401 |
quiz_html = gr.Markdown("")
|
| 402 |
download_quiz_btn = gr.DownloadButton(
|
| 403 |
-
label="📋 Download Quiz (.
|
| 404 |
variant="secondary",
|
| 405 |
scale=1,
|
| 406 |
)
|
|
|
|
| 400 |
)
|
| 401 |
quiz_html = gr.Markdown("")
|
| 402 |
download_quiz_btn = gr.DownloadButton(
|
| 403 |
+
label="📋 Download Quiz (.html)",
|
| 404 |
variant="secondary",
|
| 405 |
scale=1,
|
| 406 |
)
|
pages/artifacts.py
CHANGED
|
@@ -15,8 +15,10 @@ def _save_artifact_to_temp_file(artifact) -> str | None:
|
|
| 15 |
return artifact.audio_path
|
| 16 |
else:
|
| 17 |
safe_title = artifact.title.replace(" ", "_")[:50]
|
|
|
|
|
|
|
| 18 |
with tempfile.NamedTemporaryFile(
|
| 19 |
-
mode='w', suffix=
|
| 20 |
delete=False, encoding='utf-8'
|
| 21 |
) as f:
|
| 22 |
f.write(artifact.content)
|
|
|
|
| 15 |
return artifact.audio_path
|
| 16 |
else:
|
| 17 |
safe_title = artifact.title.replace(" ", "_")[:50]
|
| 18 |
+
# Save quizzes as HTML (they contain styled HTML), others as markdown
|
| 19 |
+
suffix = '.html' if artifact.type == "quiz" else '.md'
|
| 20 |
with tempfile.NamedTemporaryFile(
|
| 21 |
+
mode='w', suffix=suffix, prefix=f'{safe_title}_',
|
| 22 |
delete=False, encoding='utf-8'
|
| 23 |
) as f:
|
| 24 |
f.write(artifact.content)
|