diff --git a/text_to_speech.py b/text_to_speech.py index 72d04bd..2396d8b 100644 --- a/text_to_speech.py +++ b/text_to_speech.py @@ -1,28 +1,20 @@ -""" -Basic example of scraping pipeline using SpeechSummaryGraph -""" - from scrapegraphai.graphs import SpeechSummaryGraph -def text_to_speech(key:str, prompt:str, url:str): - """ - Given a text it reads after the prompt +def text_to_speech(api_key: str, prompt: str, url: str): + """Reads text after the prompt from a given URL. + Args: - - url (str): url to scrape - - prompt(str): prompt to do - - key(str) openaikey + - api_key (str): OpenAI API key + - prompt (str): Prompt to use + - url (str): URL to scrape + Returns: + - str: Path to the generated audio file """ - - - llm_config = { - "api_key": key - } - - # Save the audio to a file + llm_config = {"api_key": api_key} + + # Define the name of the audio file audio_file = "audio_result.mp3" - speech_summary_graph = SpeechSummaryGraph(prompt, - url, llm_config, - audio_file) - return speech_summary_graph.run() - \ No newline at end of file + # Create and run the speech summary graph + speech_summary_graph = SpeechSummaryGraph(prompt, url, llm_config, audio_file) + return speech_summary_graph.run() \ No newline at end of file