souzatharsis / podcastfy

An Open Source Python alternative to NotebookLM's podcast feature: Transforming Multimodal Content into Captivating Multilingual Audio Conversations with GenAI
https://www.podcastfy.ai
Apache License 2.0
1.64k stars 183 forks source link

google TTS "geminimulti" says gemini API key is invalid in production env and not local #190

Closed baznta closed 3 days ago

baznta commented 4 days ago

`def generate_podcast_from_transcript(user_id, topic):

Generate podcast from URL

config = {
'conversation_style': ['Engaging', 'Fast-paced', 'Enthusiastic', 'Educational'], 
'roles_person1': 'Interviewer', 
'roles_person2': 'Subject matter expert', 
'dialogue_structure': ['Topic Introduction', 'Summary of Key Points', 'Discussions', 'Q&A Session', 'Farewell Messages'], 
'podcast_name': 'edify podcast', 
'podcast_tagline': topic, 
'output_language': 'English', 
'user_instructions': 'ensure it is thought provoking, educative and engaging ', 
'engagement_techniques': ['Thought provoking questions', 'deep dives', 'detailed explanations', 'real world examples', 'curious'], 
'creativity': 0.8
}
raw_text = transcript_store.get_transcript(user_id=user_id,topic=topic)
audio_file_from_raw_text = generate_podcast(text=raw_text,tts_model="geminimulti",conversation_config= config
                                            )

return audio_file_from_raw_text`

this works well on my device I have the API keys in a .env when I go to prod " google cloud build" after deployment it returns 

`{

"detail": "Invalid argument provided to Gemini: 400 API key not valid. Please pass a valid API key. [reason: \"API_KEY_INVALID\"\ndomain: \"googleapis.com\"\nmetadata {\n key: \"service\"\n value: \"generativelanguage.googleapis.com\"\n}\n, locale: \"en-US\"\nmessage: \"API key not valid. Please pass a valid API key.\"\n]" }`

souzatharsis commented 4 days ago

Make sure your.env file is available in your prod server

Alternatively:

Try running export = api key in your shell before using the api.

On Sun, Nov 24, 2024, 10:28 AM Bassey Nta @.***> wrote:

`def generate_podcast_from_transcript(user_id, topic):

Generate podcast from URL

config = { 'conversation_style': ['Engaging', 'Fast-paced', 'Enthusiastic', 'Educational'], 'roles_person1': 'Interviewer', 'roles_person2': 'Subject matter expert', 'dialogue_structure': ['Topic Introduction', 'Summary of Key Points', 'Discussions', 'Q&A Session', 'Farewell Messages'], 'podcast_name': 'edify podcast', 'podcast_tagline': topic, 'output_language': 'English', 'user_instructions': 'ensure it is thought provoking, educative and engaging ', 'engagement_techniques': ['Thought provoking questions', 'deep dives', 'detailed explanations', 'real world examples', 'curious'], 'creativity': 0.8 } raw_text = transcript_store.get_transcript(user_id=user_id,topic=topic) audio_file_from_raw_text = generate_podcast(text=raw_text,tts_model="geminimulti",conversation_config= config )

return audio_file_from_raw_text`

this works well on my device I have the API keys in a .env when I go to prod " google cloud build" after deployment it returns

`{

"detail": "Invalid argument provided to Gemini: 400 API key not valid. Please pass a valid API key. [reason: "API_KEY_INVALID"\ndomain: " googleapis.com"\nmetadata {\n key: "service"\n value: " generativelanguage.googleapis.com"\n}\n, locale: "en-US"\nmessage: "API key not valid. Please pass a valid API key."\n]" }`

— Reply to this email directly, view it on GitHub https://github.com/souzatharsis/podcastfy/issues/190, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADTMY3PEZYB67GBOHHGYONT2CHH73AVCNFSM6AAAAABSMHQK3GVHI2DSMVQWIX3LMV43ASLTON2WKOZSGY4DONZUGUZTKNQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

baznta commented 4 days ago

i have a .env.yaml file for adding all keys to the prod server and a cloudbuild.yaml for building the image

ralyodio commented 4 days ago

might be ip based authentication

Anthony 408-656-2473 https://profullstack.com

On Sun, Nov 24, 2024 at 5:35 AM Bassey Nta @.***> wrote:

i have a .env.yaml file for adding all keys to the prod server and a cloudbuild.yaml for building the image

— Reply to this email directly, view it on GitHub https://github.com/souzatharsis/podcastfy/issues/190#issuecomment-2496005700, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAGV5OZ4WKWVHWVMSXS2G32CHIZZAVCNFSM6AAAAABSMHQK3GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOJWGAYDKNZQGA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

souzatharsis commented 4 days ago

Hi,

It needs to be called .env

On Sun, Nov 24, 2024, 10:35 AM Bassey Nta @.***> wrote:

i have a .env.yaml file for adding all keys to the prod server and a cloudbuild.yaml for building the image

— Reply to this email directly, view it on GitHub https://github.com/souzatharsis/podcastfy/issues/190#issuecomment-2496005700, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADTMY3LQSEGYPBAHCLED4L32CHIZZAVCNFSM6AAAAABSMHQK3GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOJWGAYDKNZQGA . You are receiving this because you commented.Message ID: @.***>

baznta commented 4 days ago

Hello, please does it also need to follow the conventional

api_key_label = API key or can I stick to the yaml style of api_key_label : "Api key" ?

and I just rename the file to .env Thanks

souzatharsis commented 4 days ago

   GEMINI_API_KEY=your_gemini_api_key_here
   ELEVENLABS_API_KEY=your_elevenlabs_api_key_here
   OPENAI_API_KEY=your_openai_api_key_here
   ``

On Sun, Nov 24, 2024 at 10:43 AM Bassey Nta ***@***.***>
wrote:

> Hello, please does it also need to follow the conventional
>
> api_key_label = API key or can I stick to the yaml style of api_key_label
> : "Api key" ?
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/souzatharsis/podcastfy/issues/190#issuecomment-2496010508>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ADTMY3I22G3HMX2CRZWCNST2CHJW3AVCNFSM6AAAAABSMHQK3GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOJWGAYTANJQHA>
> .
> You are receiving this because you commented.Message ID:
> ***@***.***>
>
baznta commented 4 days ago

Thank you this works im greatful. i am now faced with a new error during audio processing

"textPayload": "ERROR:podcastfy.text_to_speech:Error during audio processing: [Errno 2] No such file or directory: 'ffprobe'",

this is from the ffmpeg package I had to install locally and add to my system vars(windows). My question is please how do I install this on gcp I am using the fully managed option "cloud run" and CloudBuild from a dockerfile. Thanks for the help @souzatharsis

ralyodio commented 4 days ago

YOu need to install ffprobe from your package manager.

Anthony 408-656-2473 https://profullstack.com

On Sun, Nov 24, 2024 at 7:07 AM Bassey Nta @.***> wrote:

Thank you this works im greatful. i am now faced with a new error during audio processing

"textPayload": "ERROR:podcastfy.text_to_speech:Error during audio processing: [Errno 2] No such file or directory: 'ffprobe'",

this is from the ffmpeg package I had to install locally and add to my system vars(windows). My question is please how do I install this on gcp I am using the fully managed option "cloud run" and CloudBuild from a dockerfile. Thanks for the help @souzatharsis https://github.com/souzatharsis

— Reply to this email directly, view it on GitHub https://github.com/souzatharsis/podcastfy/issues/190#issuecomment-2496049509, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAGV5OZOG62DKDNMAYUVQL2CHTSNAVCNFSM6AAAAABSMHQK3GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOJWGA2DSNJQHE . You are receiving this because you commented.Message ID: @.***>

baznta commented 3 days ago

thanks, @souzatharsis @ralyodio it works fine now. Great work