Spaces:
Runtime error
Runtime error
link in description
Browse files- app.py +10 -3
- papers.py +2 -1
- run_job.py +5 -3
- update_rss.py +4 -1
app.py
CHANGED
|
@@ -133,11 +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,
|
| 142 |
inputs=[
|
| 143 |
gr.Textbox(
|
|
|
|
| 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}**\n\n[Read the paper on Hugging Face]({paper_url})\n\nBased 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/Qwen3-32B) running on HF Inference.""",
|
|
|
|
|
|
|
| 148 |
fn=generate_podcast,
|
| 149 |
inputs=[
|
| 150 |
gr.Textbox(
|
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)
|
|
@@ -139,7 +141,7 @@ def main():
|
|
| 139 |
# After uploading the podcast audio
|
| 140 |
# headline, description = generate_headline_and_description(subject)
|
| 141 |
# episode_number = get_next_episode_number()
|
| 142 |
-
update_rss(subject, audio_url, audio_length)
|
| 143 |
else:
|
| 144 |
print("No audio generated.")
|
| 145 |
|
|
|
|
| 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)
|
|
|
|
| 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, paper_id=paper_id)
|
| 145 |
else:
|
| 146 |
print("No audio generated.")
|
| 147 |
|
update_rss.py
CHANGED
|
@@ -44,9 +44,12 @@ def get_next_episode_number(podcast_dir="podcasts"):
|
|
| 44 |
files = [f for f in os.listdir(podcast_dir) if f.endswith(".wav")]
|
| 45 |
return len(files) + 1
|
| 46 |
|
| 47 |
-
def update_rss(subject, audio_url, audio_length, rss_path="rss.xml"):
|
| 48 |
# Generate headline and description automatically
|
| 49 |
title, description = generate_headline_and_description(subject)
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
tree = ET.parse(rss_path)
|
| 52 |
root = tree.getroot()
|
|
|
|
| 44 |
files = [f for f in os.listdir(podcast_dir) if f.endswith(".wav")]
|
| 45 |
return len(files) + 1
|
| 46 |
|
| 47 |
+
def update_rss(subject, audio_url, audio_length, paper_id=None, rss_path="rss.xml"):
|
| 48 |
# Generate headline and description automatically
|
| 49 |
title, description = generate_headline_and_description(subject)
|
| 50 |
+
if paper_id:
|
| 51 |
+
paper_url = f"https://huggingface.co/papers/{paper_id}"
|
| 52 |
+
description += f"\n\n[Read the paper on Hugging Face]({paper_url})"
|
| 53 |
|
| 54 |
tree = ET.parse(rss_path)
|
| 55 |
root = tree.getroot()
|