Navsatitagain commited on
Commit
00bf61a
·
verified ·
1 Parent(s): 2d92b64

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -55
app.py CHANGED
@@ -1,61 +1,22 @@
1
  import streamlit as st
2
  from geo_agent import scrape_website, run_agent_analysis
3
 
4
- # --- Streamlit UI Configuration ---
5
- st.set_page_config(
6
- page_title="GEO Audit Agent",
7
- page_icon=":robot_face:",
8
- layout="centered",
9
- initial_sidebar_state="expanded"
10
- )
11
 
12
- st.title(":mag: The GEO Audit Agent")
13
- st.markdown("Enter a website URL and its niche to get an in-depth, structured AI audit based on the content of the page.")
14
 
15
- # --- User Inputs ---
16
- website_niche = st.text_input(
17
- "1. Enter the Website Niche (e.g., 'Luxury Travel Blog', 'DIY Home Repair'):",
18
- placeholder="e.g., Fitness Supplements E-commerce"
19
- )
20
-
21
- url = st.text_input(
22
- "2. Enter the Full URL (e.g., https://example.com/blog-post):",
23
- placeholder="https://yourwebsite.com/page-to-analyze"
24
- )
25
-
26
- # --- Button and Logic ---
27
- if st.button("Run GEO Audit", type="primary"):
28
- # Check if both fields are filled
29
- if not url or not website_niche:
30
- st.warning("Please enter both the website niche and the URL to run the audit.")
31
- else:
32
- # Core processing block
33
- with st.spinner('Scraping content and running AI analysis...'):
34
- # Step 1: Scrape the website content
35
- analysis_data, full_content_string = scrape_website(url)
36
-
37
- # Step 2: Handle errors from scraping (e.g., page not found)
38
- if "Error" in analysis_data:
39
- # The crucial part: THIS LINE MUST BE INDENTED under the if statement.
40
- st.error(analysis_data["Error"])
41
- else:
42
- # Step 3: Run the AI analysis only if scraping was successful
43
- try:
44
- ai_response = run_agent_analysis(url, analysis_data, full_content_string, website_niche)
45
-
46
- st.success(f"GEO Agent Audit Complete for: {url}")
47
-
48
- # Display the structured output in a code block for easy reading/copying
49
- st.code(ai_response, language="markdown")
50
-
51
- except Exception as e:
52
- # Catch any errors that occur during the API call
53
- st.error(f"An error occurred during AI analysis: {e}")
54
- st.exception(e)
55
 
56
- st.sidebar.header("About This Agent")
57
- st.sidebar.info(
58
- "This tool uses Python, Streamlit, and the Gemini API with Google Search grounding "
59
- "to analyze the content of a public URL and provide a detailed SEO/content audit."
60
- )
61
- st.sidebar.caption("Ensure your API key is configured correctly in your environment.")
 
1
  import streamlit as st
2
  from geo_agent import scrape_website, run_agent_analysis
3
 
4
+ st.set_page_config(page_title="Generative Engine Optimization (GEO) Agent MVP")
5
+ st.title("🌐 Generative Engine Optimization (GEO) Agent")
6
+ st.markdown("Enter a **full URL** below to get a GEO Audit Score based on AI-readiness. The agent scrapes the content and uses GPT-4o-mini for analysis.")
 
 
 
 
7
 
8
+ url = st.text_input("Enter the full URL (e.g., https://example.com/blog-post):")
 
9
 
10
+ if st.button("Run GEO Audit") and url:
11
+ with st.spinner('Scraping content and running AI analysis...'):
12
+
13
+ analysis_data, full_content_string = scrape_website(url)
14
+
15
+ if "Error" in analysis_data:
16
+ st.error(analysis_data["Error"])
17
+ else:
18
+
19
+ ai_response = run_agent_analysis(url, analysis_data, full_content_string)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
+ st.success(f"GEO Agent Audit Complete for: {url}")
22
+ st.code(ai_response, language='markdown') # Display the structured output