Update app.py
Browse files
app.py
CHANGED
@@ -96,21 +96,28 @@ def orchestrate_workflow(client, url):
|
|
96 |
return final_summary
|
97 |
|
98 |
# Streamlit App UI
|
99 |
-
st.
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
-
|
104 |
-
-
|
105 |
-
-
|
106 |
-
|
107 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
|
109 |
fetch_openai_api_key()
|
110 |
|
111 |
# Initialize Swarm client only after API key is set
|
112 |
if 'OPENAI_API_KEY' in os.environ and os.environ['OPENAI_API_KEY']:
|
113 |
-
# Initialize the Swarm client after API key is set
|
114 |
client = initialize_swarm_client()
|
115 |
|
116 |
# Input field for the website URL
|
@@ -118,7 +125,13 @@ if 'OPENAI_API_KEY' in os.environ and os.environ['OPENAI_API_KEY']:
|
|
118 |
url = st.text_input("Enter the URL of the website you want to scrape", placeholder="https://example.com")
|
119 |
|
120 |
# Run Workflow button
|
121 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
if url:
|
123 |
with st.spinner("Running the multi-agent workflow... This may take a moment."):
|
124 |
final_report = orchestrate_workflow(client, url)
|
@@ -128,10 +141,8 @@ if 'OPENAI_API_KEY' in os.environ and os.environ['OPENAI_API_KEY']:
|
|
128 |
else:
|
129 |
st.error("β Please enter a valid URL.")
|
130 |
else:
|
131 |
-
st.warning("β οΈ OpenAI API Key not set. Please
|
132 |
|
133 |
# Footer with credits
|
134 |
-
st.
|
135 |
-
st.markdown(""
|
136 |
-
### Acknowledgement:
|
137 |
-
""")
|
|
|
96 |
return final_summary
|
97 |
|
98 |
# Streamlit App UI
|
99 |
+
st.markdown(
|
100 |
+
"""
|
101 |
+
<style>
|
102 |
+
.title { text-align: center; font-size: 3rem; font-weight: bold; }
|
103 |
+
.description { text-align: center; font-size: 1.2rem; color: #555; }
|
104 |
+
.button-container { text-align: center; }
|
105 |
+
.ack { font-size: 0.9rem; color: #888; text-align: center; }
|
106 |
+
</style>
|
107 |
+
""",
|
108 |
+
unsafe_allow_html=True,
|
109 |
+
)
|
110 |
+
|
111 |
+
st.markdown('<div class="title">π Swarm-based Multi-Agent Web Content Analyzer</div>', unsafe_allow_html=True)
|
112 |
+
st.markdown('<div class="description">Effortlessly extract, analyze, and summarize web content using AI-powered multi-agent systems.</div>', unsafe_allow_html=True)
|
113 |
+
|
114 |
+
st.write("")
|
115 |
+
st.write("")
|
116 |
|
117 |
fetch_openai_api_key()
|
118 |
|
119 |
# Initialize Swarm client only after API key is set
|
120 |
if 'OPENAI_API_KEY' in os.environ and os.environ['OPENAI_API_KEY']:
|
|
|
121 |
client = initialize_swarm_client()
|
122 |
|
123 |
# Input field for the website URL
|
|
|
125 |
url = st.text_input("Enter the URL of the website you want to scrape", placeholder="https://example.com")
|
126 |
|
127 |
# Run Workflow button
|
128 |
+
st.write("")
|
129 |
+
st.markdown(
|
130 |
+
'<div class="button-container"><button style="padding: 10px 20px; font-size: 16px; background-color: #4CAF50; color: white; border: none; border-radius: 5px; cursor: pointer;">π Run Workflow</button></div>',
|
131 |
+
unsafe_allow_html=True,
|
132 |
+
)
|
133 |
+
|
134 |
+
if st.button("Run Workflow"):
|
135 |
if url:
|
136 |
with st.spinner("Running the multi-agent workflow... This may take a moment."):
|
137 |
final_report = orchestrate_workflow(client, url)
|
|
|
141 |
else:
|
142 |
st.error("β Please enter a valid URL.")
|
143 |
else:
|
144 |
+
st.sidebar.warning("β οΈ OpenAI API Key not set. Please check your Hugging Face secrets configuration.")
|
145 |
|
146 |
# Footer with credits
|
147 |
+
st.divider()
|
148 |
+
st.markdown('<div class="ack">Acknowledgement: </div>', unsafe_allow_html=True)
|
|
|
|