### FastAPI Setup for Podcastfy Source: https://github.com/souzatharsis/podcastfy/blob/main/README.md This snippet indicates the setup for a FastAPI service for Podcastfy, suggesting containerization with Docker and providing an example of how to make API requests. ```python Containerize podcastify and launch the api Dockerfile_api Make requests to the api look at the notebook for a clear example fetch_audio(request_data, ENDPOINT, BASE_URL) ``` -------------------------------- ### Setup and Run TinyLlama Local LLM Source: https://github.com/souzatharsis/podcastfy/blob/main/docs/source/usage/local_llm.md This bash script demonstrates downloading a llamafile, making it executable, and starting the local LLM server. It listens at http://localhost:8080 by default. ```bash # Download a llamafile from HuggingFace wget https://huggingface.co/jartine/TinyLlama-1.1B-Chat-v1.0-GGUF/resolve/main/TinyLlama-1.1B-Chat-v1.0.Q5_K_M.llamafile # Make the file executable. On Windows, instead just rename the file to end in ".exe". chmod +x TinyLlama-1.1B-Chat-v1.0.Q5_K_M.llamafile # Start the model server. Listens at http://localhost:8080 by default. ./TinyLlama-1.1B-Chat-v1.0.Q5_K_M.llamafile --server --nobrowser ``` -------------------------------- ### Clone Repository and Start Development Environment Source: https://github.com/souzatharsis/podcastfy/blob/main/docs/source/usage/docker.md Clone the Podcastfy repository and start the development environment using Docker Compose. ```bash git clone https://github.com/souzatharsis/podcastfy.git cd podcastfy docker-compose up podcastfy-dev ``` -------------------------------- ### Check Development Setup Source: https://github.com/souzatharsis/podcastfy/blob/main/docs/source/usage/docker.md Execute a command within the development Docker Compose environment to check the Podcastfy setup. ```bash docker-compose exec podcastfy-dev python3 -c "import podcastfy" ``` -------------------------------- ### Install Sphinx Source: https://github.com/souzatharsis/podcastfy/blob/main/GUIDELINES.md Install Sphinx, the documentation generator used by the project. ```bash pip install sphinx ``` -------------------------------- ### Install Gradio Client Library Source: https://github.com/souzatharsis/podcastfy/blob/main/docs/source/usage/api.md Install the necessary Python library to interact with Gradio-based APIs. ```bash pip install gradio_client ``` -------------------------------- ### Install Docker Compose on Linux Source: https://github.com/souzatharsis/podcastfy/blob/main/docs/source/usage/docker.md Download and install the Docker Compose binary for Linux systems. ```bash # Download the current stable release sudo curl -L "https://github.com/docker/compose/releases/download/v2.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose # Apply executable permissions sudo chmod +x /usr/local/bin/docker-compose # Verify installation docker-compose --version ``` -------------------------------- ### Verify Docker Installation (General) Source: https://github.com/souzatharsis/podcastfy/blob/main/docs/source/usage/docker.md A set of commands to verify the installation of Docker and Docker Compose, and test Docker functionality. ```bash # Check Docker version docker --version # Check Docker Compose version docker-compose --version # Verify Docker daemon is running docker ps # Test Docker functionality docker run hello-world ``` -------------------------------- ### Install Poetry Source: https://github.com/souzatharsis/podcastfy/blob/main/GUIDELINES.md Install Poetry, the preferred dependency manager for this project. ```bash pip install poetry ``` -------------------------------- ### Example Output Result from API Source: https://github.com/souzatharsis/podcastfy/blob/main/docs/source/usage/api.md This is an example of the server-sent event data received when a podcast generation is complete. It includes the file path and a downloadable URL. ```text event: complete data: [{"path": "/tmp/gradio/bcb143f492b1c9a6dbde512557541e62f090bca083356be0f82c2e12b59af100/podcast_81106b4ca62542f1b209889832a421df.mp3", "url": "https://thatupiso-podcastfy-ai-demo.hf.space/gradio_a/gradio_api/file=/tmp/gradio/bcb143f492b1c9a6dbde512557541e62f090bca083356be0f82c2e12b59af100/podcast_81106b4ca62542f1b209889832a421df.mp3", "size": null, "orig_name": "podcast_81106b4ca62542f1b209889832a421df.mp3", "mime_type": null, "is_stream": false, "meta": {"_type": "gradio.FileData"}}] ``` -------------------------------- ### Install IPython Package Source: https://github.com/souzatharsis/podcastfy/blob/main/podcastfy.ipynb Installs the IPython package using pip, which is required for embedding audio in notebooks. ```shell %pip install ipython ``` -------------------------------- ### Verify Docker Installation (Windows/macOS) Source: https://github.com/souzatharsis/podcastfy/blob/main/docs/source/usage/docker.md Command to verify the Docker installation by checking its version. ```bash docker --version ``` -------------------------------- ### Verify Podcastfy Installation Source: https://github.com/souzatharsis/podcastfy/blob/main/docs/source/usage/docker.md Verify the Podcastfy installation by checking if the package can be imported in a bash environment. ```bash python3 -c "import podcastfy" ``` -------------------------------- ### Enable Docker Service on Boot (Linux) Source: https://github.com/souzatharsis/podcastfy/blob/main/docs/source/usage/docker.md Commands to configure Docker and containerd services to start automatically on system boot. ```bash sudo systemctl enable docker.service sudo systemctl enable containerd.service ``` -------------------------------- ### Setup Local LLM Server with Llamafile Source: https://github.com/souzatharsis/podcastfy/blob/main/podcastfy.ipynb This bash script demonstrates downloading, making executable, and running a llamafile for a local LLM server. It defaults to listening on http://localhost:8080. ```bash # Download a llamafile from HuggingFace wget https://huggingface.co/jartine/TinyLlama-1.1B-Chat-v1.0-GGUF/resolve/main/TinyLlama-1.1B-Chat-v1.0.Q5_K_M.llamafile # Make the file executable. On Windows, instead just rename the file to end in ".exe". chmod +x TinyLlama-1.1B-Chat-v1.0.Q5_K_M.llamafile # Start the model server. Listens at http://localhost:8080 by default. ./TinyLlama-1.1B-Chat-v1.0.Q5_K_M.llamafile --server --nobrowser ``` -------------------------------- ### Check cURL Installation Source: https://github.com/souzatharsis/podcastfy/blob/main/docs/source/usage/api.md Verify that cURL is installed on your system by checking its version. ```bash curl --version ``` -------------------------------- ### Install Docker Engine on Ubuntu/Debian Source: https://github.com/souzatharsis/podcastfy/blob/main/docs/source/usage/docker.md Commands to install Docker Engine, CLI, and Compose plugin on Ubuntu/Debian systems. ```bash # Remove old versions sudo apt-get remove docker docker-engine docker.io containerd runc # Install prerequisites sudo apt-get update sudo apt-get install \ ca-certificates \ curl \ gnupg \ lsb-release # Add Docker's official GPG key sudo mkdir -p /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg # Set up repository echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null # Install Docker Engine sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin # Add your user to docker group (optional, to run docker without sudo) sudo usermod -aG docker $USER newgrp docker # Verify installation docker --version ``` -------------------------------- ### Pull and Start Podcastfy Container Source: https://github.com/souzatharsis/podcastfy/blob/main/docs/source/usage/docker.md Pull the latest production image and start the Podcastfy service using Docker Compose. ```bash docker pull ghcr.io/souzatharsis/podcastfy:latest docker-compose up podcastfy ``` -------------------------------- ### Select ElevenLabs TTS Model Source: https://github.com/souzatharsis/podcastfy/blob/main/podcastfy.ipynb Demonstrates how to select a specific Text-to-Speech model for podcast generation. This example uses the ElevenLabs model. ```python audio_file = generate_podcast(urls=["https://en.wikipedia.org/wiki/Podcast"], tts_model="elevenlabs") ``` -------------------------------- ### API Key Setup and Validation Source: https://github.com/souzatharsis/podcastfy/blob/main/podcastfy.ipynb This Python script imports necessary libraries, defines required API keys (Google, OpenAI, ElevenLabs) from environment variables, and validates their presence. It raises a ValueError if any keys are missing. ```python import requests import json import os from pathlib import Path import os # Define required API keys API_KEYS = { "GOOGLE_API_KEY": os.getenv("GOOGLE_API_KEY"), "OPENAI_API_KEY": os.getenv("OPENAI_API_KEY"), "ELEVENLABS_API_KEY": os.getenv("ELEVENLABS_API_KEY"), } # Validate API keys missing_keys = [key for key, value in API_KEYS.items() if not value] if missing_keys: raise ValueError(f"Missing API keys: {', '.join(missing_keys)}. Ensure they are set in environment variables.") # Use API keys GOOGLE_KEY = API_KEYS["GOOGLE_API_KEY"] OPENAI_KEY = API_KEYS["OPENAI_API_KEY"] ELEVENLABS_KEY = API_KEYS["ELEVENLABS_API_KEY"] print("API keys successfully loaded.") ``` -------------------------------- ### Generate podcast from PDF (commented out) Source: https://github.com/souzatharsis/podcastfy/blob/main/usage/examples.ipynb A commented-out example showing how to generate a podcast from a PDF file using the generate_podcast function. This snippet is not active. ```python #audio_file = generate_podcast(urls=["../data/pdf/s41598-024-58826-w.pdf"], # tts_model="geminimulti") ``` -------------------------------- ### Clone Repository Source: https://github.com/souzatharsis/podcastfy/blob/main/GUIDELINES.md Clone your forked repository locally to start making changes. ```bash git clone https://github.com/your-username/podcastfy.git ``` -------------------------------- ### Initiate Podcast Generation and Fetch Results Source: https://github.com/souzatharsis/podcastfy/blob/main/usage/api.md This operation involves two steps: first, a POST request to initiate podcast processing, which returns an EVENT_ID. Second, a GET request using the obtained EVENT_ID to fetch the generated podcast results. A delay of 1-3 minutes is expected between these steps. ```APIDOC ## POST /gradio_api/call/process_inputs ### Description Initiates the podcast generation process by sending input data to the API. Returns an EVENT_ID that is used to track and retrieve the results. ### Method POST ### Endpoint https://thatupiso-podcastfy-ai-demo.hf.space/gradio_api/call/process_inputs ### Parameters #### Request Body - **data** (array) - Required - An array containing the input parameters for podcast generation in the following order: - **text_input** (string) - Direct text input for podcast generation - **urls_input** (string) - URLs to process (include http:// or https://) - **pdf_files** (array) - List of PDF files to process - **image_files** (array) - List of image files to process - **gemini_key** (string) - Google Gemini API key - **openai_key** (string) - OpenAI API key - **elevenlabs_key** (string) - ElevenLabs API key - **word_count** (number) - Target word count for podcast - **conversation_style** (string) - Conversation style descriptors (e.g. "engaging,fast-paced") - **roles_person1** (string) - Role of first speaker - **roles_person2** (string) - Role of second speaker - **dialogue_structure** (string) - Structure of dialogue (e.g. "Introduction,Content,Conclusion") - **podcast_name** (string) - Name of the podcast - **podcast_tagline** (string) - Podcast tagline - **tts_model** (string) - Text-to-speech model ("gemini", "openai", "elevenlabs", or "edge") - **creativity_level** (number) - Level of creativity (0-1) - **user_instructions** (string) - Custom instructions for generation ### Request Example ```json { "data": [ "text_input", "https://yourwebsite.com", [], [], "gemini_key", "openai_key", "elevenlabs_key", 2000, "engaging,fast-paced", "main summarizer", "questioner", "Introduction,Content,Conclusion", "PODCASTFY", "YOUR PODCAST", "openai", 0.7, "" ] } ``` ## GET /gradio_api/call/process_inputs/$EVENT_ID ### Description Fetches the results of a podcast generation process using the provided EVENT_ID. The response will contain information about the generated podcast file, including its path and URL. ### Method GET ### Endpoint https://thatupiso-podcastfy-ai-demo.hf.space/gradio_api/call/process_inputs/$EVENT_ID ### Response #### Success Response (200) - **event** (string) - Indicates the completion status, e.g., "complete". - **data** (array) - Contains details about the generated podcast file: - **path** (string) - The server path to the generated podcast file. - **url** (string) - The URL to access the generated podcast file (note: this URL might require prefixing with "https://thatupiso-podcastfy-ai-demo.hf.space/gradio_a/gradio_api/file="). - **size** (number) - The size of the podcast file (can be null). - **orig_name** (string) - The original name of the podcast file. - **mime_type** (string) - The MIME type of the file (can be null). - **is_stream** (boolean) - Indicates if the file is a stream. - **meta** (object) - Metadata about the file, including `_type`: "gradio.FileData". ### Response Example ```json { "event": "complete", "data": [ { "path": "/tmp/gradio/bcb143f492b1c9a6dbde512557541e62f090bca083356be0f82c2e12b59af100/podcast_81106b4ca62542f1b209889832a421df.mp3", "url": "https://thatupiso-podcastfy-ai-demo.hf.space/gradio_a/gradio_api/file=/tmp/gradio/bcb143f492b1c9a6dbde512557541e62f090bca083356be0f82c2e12b59af100/podcast_81106b4ca62542f1b209889832a421df.mp3", "size": null, "orig_name": "podcast_81106b4ca62542f1b209889832a421df.mp3", "mime_type": null, "is_stream": false, "meta": { "_type": "gradio.FileData" } } ] } ``` ``` -------------------------------- ### Set User Instructions in YAML Configuration Source: https://github.com/souzatharsis/podcastfy/blob/main/docs/source/usage/how-to.md Use this YAML snippet to define specific instructions for the AI hosts, guiding the conversation's focus. ```yaml user_instructions: "Make connections with quantum computing" ``` -------------------------------- ### Common Docker Commands for Podcastfy Source: https://github.com/souzatharsis/podcastfy/blob/main/docs/source/usage/docker.md A collection of common Docker commands for managing Podcastfy containers, including pulling images, starting services, building, viewing logs, and stopping containers. ```bash # Pull latest production image docker pull ghcr.io/souzatharsis/podcastfy:latest # Pull development image docker pull ghcr.io/souzatharsis/podcastfy:dev # Start production service docker-compose up podcastfy # Start development environment docker-compose up podcastfy-dev # Run tests docker-compose up test # Build images locally docker-compose build # View logs docker-compose logs # Stop all containers docker-compose down ``` -------------------------------- ### Select Google Gemini Multi-speaker TTS Model Source: https://github.com/souzatharsis/podcastfy/blob/main/podcastfy.ipynb Demonstrates how to select a specific Text-to-Speech model for podcast generation. This example uses Google's recommended multispeaker model. ```python audio_file = generate_podcast(urls=["https://en.wikipedia.org/wiki/Podcast"], tts_model="geminimulti") ``` -------------------------------- ### Initiate Podcast Processing via cURL Source: https://github.com/souzatharsis/podcastfy/blob/main/docs/source/usage/api.md Send a POST request to the Podcastfy API to start podcast generation. This request returns an EVENT_ID required for fetching the results. ```bash curl -X POST https://thatupiso-podcastfy-ai-demo.hf.space/gradio_api/call/process_inputs \ -H "Content-Type: application/json" \ -d '{ "data": [ "text_input", "https://yourwebsite.com", [], # pdf_files [], # image_files "gemini_key", "openai_key", "elevenlabs_key", 2000, # word_count "engaging,fast-paced", # conversation_style "main summarizer", # roles_person1 "questioner", # roles_person2 "Introduction,Content,Conclusion", # dialogue_structure "PODCASTFY", # podcast_name "YOUR PODCAST", # podcast_tagline "openai", # tts_model 0.7, # creativity_level "" # user_instructions ] }' ``` -------------------------------- ### Initialize Google Generative AI Source: https://github.com/souzatharsis/podcastfy/blob/main/podcastfy.ipynb Initializes the Google Generative AI client using an API key loaded from environment variables. This setup is required for utilizing Google's LLM models through the podcastfy package. ```python import os import google.generativeai as genai from dotenv import load_dotenv from podcastfy.client import generate_podcast load_dotenv() ``` -------------------------------- ### Create Directory and Navigate Source: https://github.com/souzatharsis/podcastfy/blob/main/docs/source/usage/docker.md Create a new directory for Podcastfy and navigate into it. ```bash mkdir -p /path/to/podcastfy cd /path/to/podcastfy ``` -------------------------------- ### Podcastfy CLI Help Source: https://github.com/souzatharsis/podcastfy/blob/main/docs/source/usage/cli.md Display all available command-line options and their descriptions for the Podcastfy client. ```bash python -m podcastfy.client --help ``` -------------------------------- ### Configure Technical Tutorial Podcast Source: https://github.com/souzatharsis/podcastfy/blob/main/paper/paper.md Sets up configuration for generating a technical tutorial podcast with specific dialogue structure and engagement techniques. ```python tutorial_config = { "word_count": 2500, "conversation_style": ["instructional", "step-by-step"], "roles_person1": "expert developer", "roles_person2": "learning developer", "dialogue_structure": [ "Concept Introduction", "Technical Background", "Implementation Steps", "Common Pitfalls", "Best Practices" ], "engagement_techniques": [ "code examples", "real-world applications", "troubleshooting tips" ], "creativity": 0.4 } generate_podcast( urls=["https://tech-blog.com/tutorial"], conversation_config=tutorial_config ) ``` -------------------------------- ### Configure Daily News Briefing Podcast Source: https://github.com/souzatharsis/podcastfy/blob/main/paper/paper.md Sets up configuration for a concise and informative daily news briefing podcast, including market updates and weather. ```python news_config = { "word_count": 1500, "conversation_style": ["concise", "informative"], "podcast_name": "Morning Briefing", "dialogue_structure": [ "Headlines", "Key Stories", "Market Update", "Weather" ], "roles_person1": "news anchor", "roles_person2": "field reporter", "creativity": 0.3 } generate_podcast( urls=[ "https://news-source.com/headlines", "https://market-updates.com/today" ], conversation_config=news_config ) ``` -------------------------------- ### Run Podcastfy CLI with Custom Configuration Source: https://github.com/souzatharsis/podcastfy/blob/main/docs/source/usage/how-to.md Execute the Podcastfy client from the command line, specifying a URL and a path to your custom configuration file. ```bash python -m podcastfy.client --url https://en.wikipedia.org/wiki/Artificial_intelligence --conversation-config path/to/custom_config.yaml ``` -------------------------------- ### Configure podcast generation with Japanese art images Source: https://github.com/souzatharsis/podcastfy/blob/main/usage/examples.ipynb Sets up the conversation configuration and image paths for generating a podcast discussing Japanese art. Includes user instructions for overlapping sentences and personal connections. ```python images = ["https://raw.githubusercontent.com/souzatharsis/podcastfy/refs/heads/main/data/images/japan_1.jpg", "https://raw.githubusercontent.com/souzatharsis/podcastfy/refs/heads/main/data/images/japan2.jpg"] ``` ```python conversation_config = { "roles_person1": "Abstract Art Ph.D.", "roles_person2": "Creative Abstract Artist", "podcast_name": "Japan Arts Podcast", "podcast_tagline": "Because Art is Everywhere", "creativity": 1, "user_instructions": "Speakers should often overlap in their sentences. The conversation should be about the relationship between art and life. Person2 should make connections with her own life!" } ``` -------------------------------- ### Configure podcast generation with abstract art images Source: https://github.com/souzatharsis/podcastfy/blob/main/usage/examples.ipynb Sets up the conversation configuration and image paths for generating a podcast discussing abstract art. The configuration specifies roles, podcast details, and creativity level. ```python conversation_config = { "roles_person1": "Abstract Art Ph.D. Professor", "roles_person2": "Abstract Art Grad Student", "podcast_name": "Artfy Podcast", "podcast_tagline": "Because Art is Everywhere", "creativity": 1 } ``` ```python images = ["https://raw.githubusercontent.com/souzatharsis/podcastfy/refs/heads/main/data/images/Senecio.jpeg", "https://raw.githubusercontent.com/souzatharsis/podcastfy/refs/heads/main/data/images/connection.jpg"] ``` -------------------------------- ### Create New Branch Source: https://github.com/souzatharsis/podcastfy/blob/main/GUIDELINES.md Create a new branch for your feature or bug fix before starting development. ```bash git checkout -b feature/your-feature-name ``` -------------------------------- ### Generate Podcast from Image Files Source: https://github.com/souzatharsis/podcastfy/blob/main/docs/source/usage/cli.md Create a podcast by providing image files. The content will be extracted from the images. ```bash python -m podcastfy.client --image path/to/image1.jpg --image path/to/image2.png ``` -------------------------------- ### Generate Podcast from Wikipedia URL Source: https://github.com/souzatharsis/podcastfy/blob/main/podcastfy.ipynb Initiates podcast generation from a single URL. This example uses a Wikipedia page as input. ```python audio_file = generate_podcast(urls=["https://en.wikipedia.org/wiki/Podcast"]) ``` -------------------------------- ### Generate Documentation Source: https://github.com/souzatharsis/podcastfy/blob/main/GUIDELINES.md Generate the project documentation using Sphinx. ```bash make doc-gen ``` -------------------------------- ### Generate Podcast from File of URLs Source: https://github.com/souzatharsis/podcastfy/blob/main/docs/source/usage/cli.md Create a podcast by providing a text file containing a list of URLs. ```bash python -m podcastfy.client --file path/to/urls.txt ``` -------------------------------- ### Embed generated podcast audio from PDF (commented out) Source: https://github.com/souzatharsis/podcastfy/blob/main/usage/examples.ipynb A commented-out example showing how to embed the audio generated from a PDF. This snippet is not active. ```python #embed_audio(audio_file) ``` -------------------------------- ### Generate Conversational Content Source: https://github.com/souzatharsis/podcastfy/blob/main/paper/paper.md Example of generating conversational text using a provided input. This snippet assumes a 'generator' object is already initialized. ```python input_text = "This is a sample input text about artificial intelligence." generated_conversation = generator.generate_conversation(input_text) print("Generated Conversation:") print(generated_conversation) ``` -------------------------------- ### Initialize Content Generator Source: https://github.com/souzatharsis/podcastfy/blob/main/paper/paper.md Shows how to initialize the ContentGenerator module, requiring an API key for its operation. ```python from podcastfy.content_generator import ContentGenerator # Initialize the content generator generator = ContentGenerator(api_key="") ``` -------------------------------- ### Select Microsoft Edge TTS Model Source: https://github.com/souzatharsis/podcastfy/blob/main/podcastfy.ipynb Demonstrates how to select a specific Text-to-Speech model for podcast generation. This example uses the Microsoft Edge model. ```python audio_file = generate_podcast(urls=["https://en.wikipedia.org/wiki/Podcast"], tts_model="edge") ``` -------------------------------- ### Generate Podcast using Python Source: https://github.com/souzatharsis/podcastfy/blob/main/docs/source/index.md Use the `generate_podcast` function from the `podcastfy.client` module to create a podcast from a list of URLs. Ensure you have the necessary imports. ```python from podcastfy.client import generate_podcast audio_file = generate_podcast(urls=["", ""]) ``` -------------------------------- ### Truncated Error Message for API Key Source: https://github.com/souzatharsis/podcastfy/blob/main/podcastfy.ipynb Displays a truncated error message indicating a missing API key or ADC, guiding the user on how to resolve the issue. ```text Error (truncated): [31mDefaultCredentialsError [39m: No API_KEY or ADC found. Please either: - Set the `GOOGLE_API_KEY` environment variable. - Manually pass the key with `genai.configure(api_key=my_api_key)`. - Or set up Application Default Credentials, see https://ai.google.dev/gemini-api/docs/oauth for more information. ``` -------------------------------- ### Select Google Gemini TTS Model Source: https://github.com/souzatharsis/podcastfy/blob/main/podcastfy.ipynb Demonstrates how to select a specific Text-to-Speech model for podcast generation. This example uses Google's single speaker Journey model. ```python audio_file = generate_podcast(urls=["https://en.wikipedia.org/wiki/Podcast"], tts_model="gemini") ``` -------------------------------- ### Configure Language Learning Podcast Source: https://github.com/souzatharsis/podcastfy/blob/main/paper/paper.md Configures Podcastfy to generate educational language learning content with vocabulary explanations and cultural context. ```python language_config = { "output_language": "Spanish", "word_count": 1000, "conversation_style": ["educational", "casual"], "engagement_techniques": [ "vocabulary explanations", "cultural context", "pronunciation tips" ], "roles_person1": "language teacher", "roles_person2": "curious student", "creativity": 0.6 } generate_podcast( urls=["https://spanish-content.com/article"], conversation_config=language_config ) ``` -------------------------------- ### Generate Podcast from URLs and File Source: https://github.com/souzatharsis/podcastfy/blob/main/docs/source/usage/cli.md Combine URLs and a file containing URLs to generate a single podcast. ```bash python -m podcastfy.client --url https://example.com/article1 --file path/to/urls.txt ``` -------------------------------- ### Initialize Gradio Client in Python Source: https://github.com/souzatharsis/podcastfy/blob/main/docs/source/usage/api.md Instantiate the Gradio client to connect to the specified API endpoint. ```python from gradio_client import Client, handle_file client = Client("thatupiso/Podcastfy.ai_demo") ``` -------------------------------- ### Academic Debate Conversation Configuration Source: https://github.com/souzatharsis/podcastfy/blob/main/docs/source/usage/conversation_custom.md Configure podcast settings for a formal academic debate. This setup increases word count, uses analytical conversation styles, defines specific roles for debaters, structures the dialogue like a debate, and employs critical engagement techniques. Set creativity to a low value for factual accuracy. ```python { "word_count": 3000, # Longer to allow for detailed arguments "conversation_style": ["formal", "analytical", "critical"], # Appropriate for academic discourse "roles_person1": "thesis presenter", # Presents the main argument "roles_person2": "counterargument provider", # Challenges the thesis "dialogue_structure": [ "Opening Statements", "Thesis Presentation", "Counterarguments", "Rebuttals", "Closing Remarks" ], # Mimics a structured debate format "podcast_name": "Scholarly Showdown", "podcast_tagline": "Where Ideas Clash and Knowledge Emerges", "engagement_techniques": [ "socratic questioning", "historical references", "thought experiments" ], # Techniques to stimulate critical thinking "creativity": 0 # Low creativity to maintain focus on facts and logic } ``` -------------------------------- ### Generate Podcast from File Path Source: https://github.com/souzatharsis/podcastfy/blob/main/podcastfy.ipynb Generates a podcast using a list of URLs provided in a text file. Each URL should be on a new line. ```python audio_file = generate_podcast(file_path="./data/urls.txt") ``` -------------------------------- ### Generate Podcast from URLs and Images Source: https://github.com/souzatharsis/podcastfy/blob/main/docs/source/usage/cli.md Generate a podcast by combining content from both web URLs and image files. ```bash python -m podcastfy.client --url https://example.com/article1 --image path/to/image1.jpg ``` -------------------------------- ### Using OpenAI GPT-4 Turbo with Podcastfy Source: https://github.com/souzatharsis/podcastfy/blob/main/docs/source/usage/how-to.md Select a specific cloud-based LLM model like OpenAI's GPT-4 Turbo by providing the model name and API key label to the generate_podcast function. Ensure your environment variables are correctly set. ```python audio_file = generate_podcast( urls=["https://en.wikipedia.org/wiki/Artificial_intelligence"], llm_model_name="gpt-4-turbo", api_key_label="OPENAI_API_KEY" ) ``` -------------------------------- ### Import necessary libraries Source: https://github.com/souzatharsis/podcastfy/blob/main/usage/examples.ipynb Imports the generate_podcast function from the podcastfy client. ```python from podcastfy.client import generate_podcast ``` -------------------------------- ### Import Podcastfy and Load Environment Variables Source: https://github.com/souzatharsis/podcastfy/blob/main/podcastfy.ipynb Imports the necessary `generate_podcast` function from the podcastfy client and loads environment variables using `dotenv`. This is a prerequisite for using most podcastfy functionalities. ```python from podcastfy.client import generate_podcast # !pip install duckduckgo-search import os from dotenv import load_dotenv # This automatically loads from .env file load_dotenv() ``` -------------------------------- ### Check Production Version Source: https://github.com/souzatharsis/podcastfy/blob/main/docs/source/usage/docker.md Run a command to check the production version of the Podcastfy Docker image. ```bash docker run --rm ghcr.io/souzatharsis/podcastfy:latest python3 -c "import podcastfy" ```