abdibrokhim commited on
Commit
ecf661c
·
1 Parent(s): ccee732

add dotenv

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import os
2
  import gradio as gr
3
  from aixplain.factories import AgentFactory, ModelFactory
 
4
 
5
  SYSTEM_PROMPT = """
6
  You are an SEO Keyword Generator AI Agent. You must only provide lists of SEO keywords related to the user's specified topic or domain. Follow these rules:
@@ -31,8 +32,11 @@ Your output must always adhere to these rules and only provide a list of SEO key
31
 
32
  # Function to generate keywords
33
  def generate_keywords(api_key, topic):
 
 
 
34
  # Set aiXplain API key dynamically
35
- os.environ["AIXPLAIN_API_KEY"] = api_key
36
 
37
  # Create the AI agent for keyword generation
38
  agent = AgentFactory.create(
 
1
  import os
2
  import gradio as gr
3
  from aixplain.factories import AgentFactory, ModelFactory
4
+ from dotenv import load_dotenv
5
 
6
  SYSTEM_PROMPT = """
7
  You are an SEO Keyword Generator AI Agent. You must only provide lists of SEO keywords related to the user's specified topic or domain. Follow these rules:
 
32
 
33
  # Function to generate keywords
34
  def generate_keywords(api_key, topic):
35
+ # Load environment variables from .env file
36
+ load_dotenv()
37
+
38
  # Set aiXplain API key dynamically
39
+ os.environ["AIXPLAIN_API_KEY"] = api_key or os.getenv("AIXPLAIN_API_KEY")
40
 
41
  # Create the AI agent for keyword generation
42
  agent = AgentFactory.create(