Update lab/interim2.py
Browse files- lab/interim2.py +13 -12
lab/interim2.py
CHANGED
@@ -4,7 +4,8 @@ from crew import *
|
|
4 |
import os
|
5 |
import base64
|
6 |
|
7 |
-
st.
|
|
|
8 |
|
9 |
# Ensure session state variables are initialized properly
|
10 |
if "messages" not in st.session_state:
|
@@ -18,9 +19,11 @@ if "chat_active" not in st.session_state:
|
|
18 |
|
19 |
# Sidebar with essay settings and user-defined length
|
20 |
with st.sidebar:
|
21 |
-
st.subheader("
|
22 |
-
st.info(
|
23 |
-
|
|
|
|
|
24 |
|
25 |
# API Key Retrieval
|
26 |
openai_key = st.secrets.get("OPENAI_API_KEY", "")
|
@@ -28,11 +31,11 @@ with st.sidebar:
|
|
28 |
st.divider()
|
29 |
|
30 |
# User-defined essay length selection
|
31 |
-
st.subheader("📝 Essay Settings:")
|
32 |
essay_length = st.number_input(
|
33 |
"Select Essay Length (words):",
|
34 |
min_value=150,
|
35 |
-
max_value=
|
36 |
value=250,
|
37 |
step=50
|
38 |
)
|
@@ -62,7 +65,7 @@ def initialize_agents():
|
|
62 |
st.session_state["chat_active"] = False
|
63 |
|
64 |
# Success message
|
65 |
-
st.success("✅ Agents successfully initialized!")
|
66 |
return essay_writer
|
67 |
except Exception as e:
|
68 |
st.error(f"❌ Error initializing agents: {e}")
|
@@ -127,12 +130,10 @@ if topic := st.chat_input(placeholder="📝 Ask a question or provide an essay t
|
|
127 |
st.session_state["messages"].append({"role": "assistant", "content": response["response"]})
|
128 |
|
129 |
# Acknowledgment Section
|
130 |
-
st.markdown("---")
|
131 |
-
st.markdown("---")
|
132 |
st.markdown(
|
133 |
"""
|
134 |
-
<div style="text-align: center; font-size: 14px; color: #555;">
|
135 |
-
<strong>Acknowledgment:</strong> This
|
136 |
<a href="https://github.com/mesutdmn/Autonomous-Multi-Agent-Systems-with-CrewAI-Essay-Writer/tree/main"
|
137 |
target="_blank" style="color: #007BFF; text-decoration: none;">
|
138 |
CrewAI Essay Writer
|
@@ -140,4 +141,4 @@ st.markdown(
|
|
140 |
</div>
|
141 |
""",
|
142 |
unsafe_allow_html=True,
|
143 |
-
)
|
|
|
4 |
import os
|
5 |
import base64
|
6 |
|
7 |
+
#st.title("Multi-Agent Essay Writing Assistant")
|
8 |
+
st.set_page_config(page_title="Multi-Agent Essay Writing Assistant", page_icon="🤖🤖🤖✍️", layout = "centered")
|
9 |
|
10 |
# Ensure session state variables are initialized properly
|
11 |
if "messages" not in st.session_state:
|
|
|
19 |
|
20 |
# Sidebar with essay settings and user-defined length
|
21 |
with st.sidebar:
|
22 |
+
st.subheader("About:")
|
23 |
+
st.info(
|
24 |
+
"\n\n* This app uses the 'gpt-4o-mini-2024-07-18' model."
|
25 |
+
"\n\n* Writing essays may take some time, approximately 1-2 minutes."
|
26 |
+
)
|
27 |
|
28 |
# API Key Retrieval
|
29 |
openai_key = st.secrets.get("OPENAI_API_KEY", "")
|
|
|
31 |
st.divider()
|
32 |
|
33 |
# User-defined essay length selection
|
34 |
+
st.subheader("📝 Configure Essay Settings:")
|
35 |
essay_length = st.number_input(
|
36 |
"Select Essay Length (words):",
|
37 |
min_value=150,
|
38 |
+
max_value=400,
|
39 |
value=250,
|
40 |
step=50
|
41 |
)
|
|
|
65 |
st.session_state["chat_active"] = False
|
66 |
|
67 |
# Success message
|
68 |
+
#st.success("✅ Agents successfully initialized!")
|
69 |
return essay_writer
|
70 |
except Exception as e:
|
71 |
st.error(f"❌ Error initializing agents: {e}")
|
|
|
130 |
st.session_state["messages"].append({"role": "assistant", "content": response["response"]})
|
131 |
|
132 |
# Acknowledgment Section
|
|
|
|
|
133 |
st.markdown(
|
134 |
"""
|
135 |
+
<div style="text-align: center; font-size: 14px; color: #555; padding-top: 250px; margin-top: 250px;">
|
136 |
+
<strong>Acknowledgment:</strong> This app is based on Mesut Duman's work:
|
137 |
<a href="https://github.com/mesutdmn/Autonomous-Multi-Agent-Systems-with-CrewAI-Essay-Writer/tree/main"
|
138 |
target="_blank" style="color: #007BFF; text-decoration: none;">
|
139 |
CrewAI Essay Writer
|
|
|
141 |
</div>
|
142 |
""",
|
143 |
unsafe_allow_html=True,
|
144 |
+
)
|