Skip to content

Commit

Permalink
Merge pull request #1 from f-aguzzi/main
Browse files Browse the repository at this point in the history
Refactoring of text to speech function.
  • Loading branch information
VinciGit00 authored Mar 4, 2024
2 parents 86e7a53 + b831d9c commit 86e0249
Showing 1 changed file with 14 additions and 22 deletions.
36 changes: 14 additions & 22 deletions text_to_speech.py
Original file line number Diff line number Diff line change
@@ -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()

# Create and run the speech summary graph
speech_summary_graph = SpeechSummaryGraph(prompt, url, llm_config, audio_file)
return speech_summary_graph.run()

0 comments on commit 86e0249

Please sign in to comment.