Spaces:
Runtime error
Runtime error
Prathamesh1420
commited on
Commit
•
63cb2cf
1
Parent(s):
6f46771
Update app.py
Browse files
app.py
CHANGED
@@ -6,9 +6,9 @@ import os
|
|
6 |
|
7 |
# Load environment variables
|
8 |
load_dotenv()
|
9 |
-
GOOGLE_API_KEY =
|
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 |
-
|
122 |
-
|
|
|
|
|
|
|
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 |
|