|
from flask import Flask, render_template |
|
import gradio as gr |
|
from scraper import scrape_url |
|
from podcast_generator import PodcastGenerator |
|
from tts import text_to_speech |
|
|
|
app = Flask(__name__) |
|
|
|
def generate_podcast(url): |
|
content = scrape_url(url) |
|
podcast_generator = PodcastGenerator() |
|
podcast_text = podcast_generator.generate_podcast(content) |
|
audio_file = text_to_speech(podcast_text) |
|
return audio_file |
|
|
|
|
|
demo = gr.Interface( |
|
fn=generate_podcast, |
|
inputs=gr.Textbox( |
|
label="Website URL", |
|
placeholder="Enter the URL of the website you want to convert to a podcast" |
|
), |
|
outputs=gr.Audio(label="Generated Podcast"), |
|
title="URL to Podcast Generator", |
|
description="Enter a URL to generate a podcast episode based on its content.", |
|
theme="huggingface", |
|
allow_flagging="never", |
|
) |
|
|
|
|
|
app = gr.mount_gradio_app(app, demo, path="/") |
|
|
|
if __name__ == "__main__": |
|
app.run( |
|
host="0.0.0.0", |
|
port=7860, |
|
debug=True |
|
) |