mirror of
https://github.com/Shubhamsaboo/awesome-llm-apps.git
synced 2026-04-30 15:20:47 -05:00
- opeani_research_agent -> openai_research_agent - web_scrapping_ai_agent -> web_scraping_ai_agent - ai_Self-Evolving_agent -> ai_self_evolving_agent (consistent naming)
38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
# Import the required libraries
|
|
import streamlit as st
|
|
from scrapegraphai.graphs import SmartScraperGraph
|
|
|
|
# Set up the Streamlit app
|
|
st.title("Web Scrapping AI Agent 🕵️♂️")
|
|
st.caption("This app allows you to scrape a website using OpenAI API")
|
|
|
|
# Get OpenAI API key from user
|
|
openai_access_token = st.text_input("OpenAI API Key", type="password")
|
|
|
|
if openai_access_token:
|
|
model = st.radio(
|
|
"Select the model",
|
|
["gpt-4o", "gpt-5"],
|
|
index=0,
|
|
)
|
|
graph_config = {
|
|
"llm": {
|
|
"api_key": openai_access_token,
|
|
"model": model,
|
|
},
|
|
}
|
|
# Get the URL of the website to scrape
|
|
url = st.text_input("Enter the URL of the website you want to scrape")
|
|
# Get the user prompt
|
|
user_prompt = st.text_input("What you want the AI agent to scrae from the website?")
|
|
|
|
# Create a SmartScraperGraph object
|
|
smart_scraper_graph = SmartScraperGraph(
|
|
prompt=user_prompt,
|
|
source=url,
|
|
config=graph_config
|
|
)
|
|
# Scrape the website
|
|
if st.button("Scrape"):
|
|
result = smart_scraper_graph.run()
|
|
st.write(result) |