Spaces:
Runtime error
Runtime error
Commit
·
e19d77c
1
Parent(s):
42d1b82
replace html string constants with actual files
Browse files- constants.py +0 -35
- description.md +5 -0
- head.html +49 -0
- main.py +2 -3
constants.py
DELETED
|
@@ -1,35 +0,0 @@
|
|
| 1 |
-
description = """
|
| 2 |
-
<p style="text-align:center">
|
| 3 |
-
<strong>Convert any PDF into a podcast episode! Experience research papers, websites, and more in a whole new way.</strong>
|
| 4 |
-
<br>
|
| 5 |
-
<a href="https://github.com/knowsuchagency/pdf-to-podcast">knowsuchagency/pdf-to-podcast</a>
|
| 6 |
-
</p>
|
| 7 |
-
"""
|
| 8 |
-
|
| 9 |
-
head = """
|
| 10 |
-
<!-- Primary Meta Tags -->
|
| 11 |
-
<title>PDF to Podcast - Convert Your Documents to Audio</title>
|
| 12 |
-
<meta name="title" content="PDF to Podcast - Convert Your Documents to Audio">
|
| 13 |
-
<meta name="description" content="Easily convert your PDF documents into audio podcasts. Perfect for listening on the go and making content more accessible.">
|
| 14 |
-
|
| 15 |
-
<!-- Open Graph / Facebook -->
|
| 16 |
-
<meta property="og:type" content="website">
|
| 17 |
-
<meta property="og:url" content="https://pdf-to-podcast.com/">
|
| 18 |
-
<meta property="og:title" content="PDF to Podcast - Convert Your Documents to Audio">
|
| 19 |
-
<meta property="og:description" content="Easily convert your PDF documents into audio podcasts. Perfect for listening on the go and making content more accessible.">
|
| 20 |
-
<meta property="og:image" content="https://pdf-to-podcast.com/static/logo.png">
|
| 21 |
-
|
| 22 |
-
<!-- Twitter -->
|
| 23 |
-
<meta property="twitter:card" content="summary_large_image">
|
| 24 |
-
<meta property="twitter:url" content="https://pdf-to-podcast.com/">
|
| 25 |
-
<meta property="twitter:title" content="PDF to Podcast - Convert Your Documents to Audio">
|
| 26 |
-
<meta property="twitter:description" content="Easily convert your PDF documents into audio podcasts. Perfect for listening on the go and making content more accessible.">
|
| 27 |
-
<meta property="twitter:image" content="https://pdf-to-podcast.com/static/logo.png">
|
| 28 |
-
|
| 29 |
-
<!-- Additional Meta Tags -->
|
| 30 |
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
| 31 |
-
<meta charset="UTF-8">
|
| 32 |
-
<meta name="author" content="Stephan Fitzpatrick">
|
| 33 |
-
<meta name="keywords" content="PDF to Podcast, PDF to audio, document to podcast, audio conversion, podcast creation, accessible content">
|
| 34 |
-
<link rel="icon" href="/static/icon.png" type="image/png">
|
| 35 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
description.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<p style="text-align:center">
|
| 2 |
+
<strong>Convert any PDF into a podcast episode! Experience research papers, websites, and more in a whole new way.</strong>
|
| 3 |
+
<br>
|
| 4 |
+
<a href="https://github.com/knowsuchagency/pdf-to-podcast">knowsuchagency/pdf-to-podcast</a>
|
| 5 |
+
</p>
|
head.html
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!-- Primary Meta Tags -->
|
| 2 |
+
<title>PDF to Podcast - Convert Your Documents to Audio</title>
|
| 3 |
+
<meta name="title" content="PDF to Podcast - Convert Your Documents to Audio" />
|
| 4 |
+
<meta
|
| 5 |
+
name="description"
|
| 6 |
+
content="Easily convert your PDF documents into audio podcasts. Perfect for listening on the go and making content more accessible."
|
| 7 |
+
/>
|
| 8 |
+
|
| 9 |
+
<!-- Open Graph / Facebook -->
|
| 10 |
+
<meta property="og:type" content="website" />
|
| 11 |
+
<meta property="og:url" content="https://pdf-to-podcast.com/" />
|
| 12 |
+
<meta
|
| 13 |
+
property="og:title"
|
| 14 |
+
content="PDF to Podcast - Convert Your Documents to Audio"
|
| 15 |
+
/>
|
| 16 |
+
<meta
|
| 17 |
+
property="og:description"
|
| 18 |
+
content="Easily convert your PDF documents into audio podcasts. Perfect for listening on the go and making content more accessible."
|
| 19 |
+
/>
|
| 20 |
+
<meta
|
| 21 |
+
property="og:image"
|
| 22 |
+
content="https://pdf-to-podcast.com/static/logo.png"
|
| 23 |
+
/>
|
| 24 |
+
|
| 25 |
+
<!-- Twitter -->
|
| 26 |
+
<meta property="twitter:card" content="summary_large_image" />
|
| 27 |
+
<meta property="twitter:url" content="https://pdf-to-podcast.com/" />
|
| 28 |
+
<meta
|
| 29 |
+
property="twitter:title"
|
| 30 |
+
content="PDF to Podcast - Convert Your Documents to Audio"
|
| 31 |
+
/>
|
| 32 |
+
<meta
|
| 33 |
+
property="twitter:description"
|
| 34 |
+
content="Easily convert your PDF documents into audio podcasts. Perfect for listening on the go and making content more accessible."
|
| 35 |
+
/>
|
| 36 |
+
<meta
|
| 37 |
+
property="twitter:image"
|
| 38 |
+
content="https://pdf-to-podcast.com/static/logo.png"
|
| 39 |
+
/>
|
| 40 |
+
|
| 41 |
+
<!-- Additional Meta Tags -->
|
| 42 |
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 43 |
+
<meta charset="UTF-8" />
|
| 44 |
+
<meta name="author" content="Stephan Fitzpatrick" />
|
| 45 |
+
<meta
|
| 46 |
+
name="keywords"
|
| 47 |
+
content="PDF to Podcast, PDF to audio, document to podcast, audio conversion, podcast creation, accessible content"
|
| 48 |
+
/>
|
| 49 |
+
<link rel="icon" href="/static/icon.png" type="image/png" />
|
main.py
CHANGED
|
@@ -18,7 +18,6 @@ from pydantic import BaseModel, ValidationError
|
|
| 18 |
from pypdf import PdfReader
|
| 19 |
from tenacity import retry, retry_if_exception_type
|
| 20 |
|
| 21 |
-
from constants import description, head
|
| 22 |
|
| 23 |
sentry_sdk.init(os.getenv("SENTRY_DSN"))
|
| 24 |
|
|
@@ -150,7 +149,7 @@ def generate_audio(file: str, openai_api_key: str = None) -> bytes:
|
|
| 150 |
|
| 151 |
demo = gr.Interface(
|
| 152 |
title="PDF to Podcast",
|
| 153 |
-
description=description,
|
| 154 |
fn=generate_audio,
|
| 155 |
examples=[[str(p)] for p in Path("examples").glob("*.pdf")],
|
| 156 |
inputs=[
|
|
@@ -168,7 +167,7 @@ demo = gr.Interface(
|
|
| 168 |
],
|
| 169 |
allow_flagging=False,
|
| 170 |
clear_btn=None,
|
| 171 |
-
head=os.getenv("HEAD", "") + head,
|
| 172 |
cache_examples="lazy",
|
| 173 |
api_name=False,
|
| 174 |
)
|
|
|
|
| 18 |
from pypdf import PdfReader
|
| 19 |
from tenacity import retry, retry_if_exception_type
|
| 20 |
|
|
|
|
| 21 |
|
| 22 |
sentry_sdk.init(os.getenv("SENTRY_DSN"))
|
| 23 |
|
|
|
|
| 149 |
|
| 150 |
demo = gr.Interface(
|
| 151 |
title="PDF to Podcast",
|
| 152 |
+
description=Path("description.md").read_text(),
|
| 153 |
fn=generate_audio,
|
| 154 |
examples=[[str(p)] for p in Path("examples").glob("*.pdf")],
|
| 155 |
inputs=[
|
|
|
|
| 167 |
],
|
| 168 |
allow_flagging=False,
|
| 169 |
clear_btn=None,
|
| 170 |
+
head=os.getenv("HEAD", "") + Path("head.html").read_text(),
|
| 171 |
cache_examples="lazy",
|
| 172 |
api_name=False,
|
| 173 |
)
|