DrishtiSharma commited on
Commit
4f6325e
Β·
verified Β·
1 Parent(s): d2c82ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -16
app.py CHANGED
@@ -96,21 +96,28 @@ def orchestrate_workflow(client, url):
96
  return final_summary
97
 
98
  # Streamlit App UI
99
- st.title("πŸ”Ž Swarm-based Multi-Agent Web Content Analyzer")
100
- st.caption("""
101
- **Effortlessly extract, analyze, and summarize information from any website!**
102
- This app leverages a **multi-agent system** built on OpenAI's Swarm framework to:
103
- - **Scrape content** from websites.
104
- - **Analyze and extract key insights** from the scraped data.
105
- - **Generate concise summaries** tailored to your needs.
106
- Simply provide a URL, and let the agents do the rest!
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
- if st.button("πŸš€ Run Workflow"):
 
 
 
 
 
 
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 ensure it's properly configured in Hugging Face secrets.")
132
 
133
  # Footer with credits
134
- st.write("---")
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)