Spaces:
Running
on
Zero
Running
on
Zero
add paper link
Browse files- app.py +10 -1
- papers.py +2 -1
- run_job.py +5 -3
- update_rss.py +5 -2
app.py
CHANGED
@@ -133,9 +133,18 @@ def generate_podcast(topic: str):
|
|
133 |
# ["https://huggingface.co/blog/inference-providers-cohere", None, "How does using this compare with other inference solutions?"],
|
134 |
# [None, str(Path("examples/Essay_Palantir.pdf")), "Make sure to keep some critic spirit in the analysis!"],
|
135 |
# ]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
demo = gr.Interface(
|
137 |
title="Daily Paper Podcast 🎙️",
|
138 |
-
description=f"""Generates a podcast discussion between two hosts about today's top trending paper on Hugging Face: '**{
|
139 |
|
140 |
Based on [Open NotebookLM](https://huggingface.co/spaces/m-ric/open-notebooklm), powered by [Kokoro TTS](https://huggingface.co/hexgrad/Kokoro-82M) and [Qwen3-32B](https://huggingface.co/Qwen/Qwen3-32B) running on HF Inference.""",
|
141 |
fn=generate_podcast,
|
|
|
133 |
# ["https://huggingface.co/blog/inference-providers-cohere", None, "How does using this compare with other inference solutions?"],
|
134 |
# [None, str(Path("examples/Essay_Palantir.pdf")), "Make sure to keep some critic spirit in the analysis!"],
|
135 |
# ]
|
136 |
+
|
137 |
+
first_paper = list(top_papers.values())[0]
|
138 |
+
paper_id = first_paper['id']
|
139 |
+
paper_url = f"https://huggingface.co/papers/{paper_id}"
|
140 |
+
paper_title = list(top_papers.keys())[0]
|
141 |
+
|
142 |
+
# Make the paper title clickable
|
143 |
+
clickable_title = f"[{paper_title}]({paper_url})"
|
144 |
+
|
145 |
demo = gr.Interface(
|
146 |
title="Daily Paper Podcast 🎙️",
|
147 |
+
description=f"""Generates a podcast discussion between two hosts about today's top trending paper on Hugging Face: '**{clickable_title}**'
|
148 |
|
149 |
Based on [Open NotebookLM](https://huggingface.co/spaces/m-ric/open-notebooklm), powered by [Kokoro TTS](https://huggingface.co/hexgrad/Kokoro-82M) and [Qwen3-32B](https://huggingface.co/Qwen/Qwen3-32B) running on HF Inference.""",
|
150 |
fn=generate_podcast,
|
papers.py
CHANGED
@@ -77,7 +77,8 @@ class PaperManager:
|
|
77 |
print(f"Processing {len(self.papers)} papers:")
|
78 |
for paper in tqdm(self.papers):
|
79 |
paper_id = paper["paper"]['id']
|
80 |
-
|
|
|
81 |
|
82 |
return contents
|
83 |
|
|
|
77 |
print(f"Processing {len(self.papers)} papers:")
|
78 |
for paper in tqdm(self.papers):
|
79 |
paper_id = paper["paper"]['id']
|
80 |
+
content = self.get_paper_text(paper_id)
|
81 |
+
contents[paper["paper"]['title']] = {"id": paper_id, "content": content}
|
82 |
|
83 |
return contents
|
84 |
|
run_job.py
CHANGED
@@ -55,8 +55,10 @@ def main():
|
|
55 |
# 1. Get the most popular paper's content
|
56 |
paper_manager = PaperManager()
|
57 |
top_papers = paper_manager.get_top_content()
|
58 |
-
# Get the first (most popular) paper's text
|
59 |
-
|
|
|
|
|
60 |
|
61 |
# 2. Generate the podcast script
|
62 |
podcast_script = generate_podcast_script(subject)
|
@@ -141,7 +143,7 @@ def main():
|
|
141 |
# After uploading the podcast audio
|
142 |
# headline, description = generate_headline_and_description(subject)
|
143 |
# episode_number = get_next_episode_number()
|
144 |
-
update_rss(subject, audio_url, audio_length)
|
145 |
|
146 |
# After update_rss(...)
|
147 |
api.upload_file(
|
|
|
55 |
# 1. Get the most popular paper's content
|
56 |
paper_manager = PaperManager()
|
57 |
top_papers = paper_manager.get_top_content()
|
58 |
+
# Get the first (most popular) paper's id and text
|
59 |
+
first_paper = list(top_papers.values())[0]
|
60 |
+
subject = first_paper['content']
|
61 |
+
paper_id = first_paper['id']
|
62 |
|
63 |
# 2. Generate the podcast script
|
64 |
podcast_script = generate_podcast_script(subject)
|
|
|
143 |
# After uploading the podcast audio
|
144 |
# headline, description = generate_headline_and_description(subject)
|
145 |
# episode_number = get_next_episode_number()
|
146 |
+
update_rss(subject, audio_url, audio_length, paper_id=paper_id)
|
147 |
|
148 |
# After update_rss(...)
|
149 |
api.upload_file(
|
update_rss.py
CHANGED
@@ -64,10 +64,13 @@ def get_next_episode_number(podcast_dir="podcasts"):
|
|
64 |
files = [f for f in os.listdir(podcast_dir) if f.endswith(".wav")]
|
65 |
return len(files) + 1
|
66 |
|
67 |
-
def update_rss(subject, audio_url, audio_length, rss_path="rss.xml"):
|
68 |
# Generate headline and description automatically
|
69 |
title, description = generate_headline_and_description(subject)
|
70 |
-
|
|
|
|
|
|
|
71 |
tree = ET.parse(rss_path)
|
72 |
root = tree.getroot()
|
73 |
channel = root.find("channel")
|
|
|
64 |
files = [f for f in os.listdir(podcast_dir) if f.endswith(".wav")]
|
65 |
return len(files) + 1
|
66 |
|
67 |
+
def update_rss(subject, audio_url, audio_length, paper_id=None, rss_path="rss.xml"):
|
68 |
# Generate headline and description automatically
|
69 |
title, description = generate_headline_and_description(subject)
|
70 |
+
if paper_id:
|
71 |
+
paper_url = f"https://huggingface.co/papers/{paper_id}"
|
72 |
+
description += f"\n\n[Read the paper on Hugging Face]({paper_url})"
|
73 |
+
|
74 |
tree = ET.parse(rss_path)
|
75 |
root = tree.getroot()
|
76 |
channel = root.find("channel")
|