DrishtiSharma commited on
Commit
608bfb2
Β·
verified Β·
1 Parent(s): 5c02a3a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -9
app.py CHANGED
@@ -41,7 +41,7 @@ scraper_agent = Agent(
41
  # Define the analysis function
42
  def analyze_content(content):
43
  """Analyzes the scraped content for key points."""
44
- summary = f"Summary of content: {content[:200]}..." # A simple placeholder summarization
45
  return summary
46
 
47
  # Research Agent
@@ -101,7 +101,21 @@ st.markdown(
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
  """,
@@ -111,9 +125,6 @@ st.markdown(
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
@@ -124,14 +135,26 @@ if 'OPENAI_API_KEY' in os.environ and os.environ['OPENAI_API_KEY']:
124
  st.subheader("🌍 Enter 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)
 
41
  # Define the analysis function
42
  def analyze_content(content):
43
  """Analyzes the scraped content for key points."""
44
+ summary = f"Summary of content: {content[:800]}..."
45
  return summary
46
 
47
  # Research Agent
 
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; margin-top: 20px; }
105
+ .custom-button {
106
+ padding: 10px 20px;
107
+ font-size: 16px;
108
+ background-color: #4CAF50;
109
+ color: white;
110
+ border: none;
111
+ border-radius: 5px;
112
+ cursor: pointer;
113
+ text-align: center;
114
+ display: inline-block;
115
+ }
116
+ .custom-button:hover {
117
+ background-color: #45a049;
118
+ }
119
  .ack { font-size: 0.9rem; color: #888; text-align: center; }
120
  </style>
121
  """,
 
125
  st.markdown('<div class="title">πŸ”Ž Swarm-based Multi-Agent Web Content Analyzer</div>', unsafe_allow_html=True)
126
  st.markdown('<div class="description">Effortlessly extract, analyze, and summarize web content using AI-powered multi-agent systems.</div>', unsafe_allow_html=True)
127
 
 
 
 
128
  fetch_openai_api_key()
129
 
130
  # Initialize Swarm client only after API key is set
 
135
  st.subheader("🌍 Enter the Website URL")
136
  url = st.text_input("Enter the URL of the website you want to scrape", placeholder="https://example.com")
137
 
138
+ # Custom green button
139
+ st.markdown('<div class="button-container"><button class="custom-button" id="run-workflow">πŸš€ Run Workflow</button></div>', unsafe_allow_html=True)
140
+
141
+ # Add JavaScript for button interaction
142
  st.markdown(
143
+ """
144
+ <script>
145
+ document.getElementById("run-workflow").onclick = function() {
146
+ var placeholder = document.querySelector("input[placeholder='https://example.com']");
147
+ if (placeholder) {
148
+ placeholder.focus();
149
+ }
150
+ };
151
+ </script>
152
+ """,
153
  unsafe_allow_html=True,
154
  )
155
 
156
+ # Run the workflow logic
157
+ if st.button("Run Workflow", key="run"):
158
  if url:
159
  with st.spinner("Running the multi-agent workflow... This may take a moment."):
160
  final_report = orchestrate_workflow(client, url)