Prathamesh1420 commited on
Commit
63cb2cf
1 Parent(s): 6f46771

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -6,9 +6,9 @@ import os
6
 
7
  # Load environment variables
8
  load_dotenv()
9
- GOOGLE_API_KEY = "AIzaSyDy02GtpV6-VcdeCZNLJT-c4kWuPxBRbrI"
10
 
11
- # Define LLM
12
  llm = ChatGoogleGenerativeAI(
13
  model="gemini-1.5-flash",
14
  verbose=True,
@@ -118,8 +118,11 @@ def main():
118
  if st.button("Generate Content"):
119
  if topic:
120
  with st.spinner('Generating content...'):
121
- result = crew.kickoff(inputs={"topic": topic})
122
- st.markdown(result)
 
 
 
123
  else:
124
  st.error("Please enter a topic.")
125
 
 
6
 
7
  # Load environment variables
8
  load_dotenv()
9
+ GOOGLE_API_KEY = os.getenv('GOOGLE_API_KEY')
10
 
11
+ # Define LLM (check if there's a synchronous alternative or ensure async handling)
12
  llm = ChatGoogleGenerativeAI(
13
  model="gemini-1.5-flash",
14
  verbose=True,
 
118
  if st.button("Generate Content"):
119
  if topic:
120
  with st.spinner('Generating content...'):
121
+ try:
122
+ result = crew.kickoff(inputs={"topic": topic})
123
+ st.markdown(result)
124
+ except Exception as e:
125
+ st.error(f"An error occurred: {e}")
126
  else:
127
  st.error("Please enter a topic.")
128