vdutts7 / gpt4V-scraper

AI agent that can SEE 👁️, control, navigate, & do stuff for you on your browser.
247 stars 25 forks source link
ai-agents browser-automation gpt-4-vision puppeteer web-scraping
Logo Logo Logo

GPT-4V Web Agent

AI agent that can SEE 👁️, control, navigate, & do stuff for you on your browser.

[![Github][github]][github-url]

Table of Contents

    💸 FREE 200 USD cloud credits
    📝 About
    💻 How to build
    🔧 Tools used
    👤 Contact


💸FREE 200 USD cloud credits

Click the banner to activate $200 free personal cloud credits on DigitalOcean (deploy anything).

📝About

💻How to build

Part 1: Screenshot + Scrape

MacOS (using Chrome Canary) ``` executablePath: '/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary', userDataDir: '/Users//Library/Application\ Support/Google/Chrome\ Canary/Default', ```
Windows (using Chrome) ``` executablePath: 'C:/Program Files/Google/Chrome/Application/chrome.exe', userDataDir: 'C:/Users//AppData/Local/Google/Chrome/User Data', ```
Linux (using Chrome) ``` executablePath: '/usr/bin/google-chrome', userDataDir: '/home//.config/google-chrome', ```

Reference:

Ex:

node snapshot.js "https://en.wikipedia.org/wiki/Devious_lick"

Wait for few seconds (adjust const timeout = 6000; if too slow), and snapshot.jpg will magically appear in root directory of project:

snapshot.jpg

Part 2: Image to Text Conversion

This next part is better than a lot of OCR software for common tasks- in my opinion.

Set up Python environment and install packages:

python3 -m venv myenv
source myenv/bin/activate
pip install -r requirements.txt

Edit the following lines in gpt4v_scraper.py, replacing with your own website URL and then a system prompt (command to the GPT-4V API) about what to scrape for. See my example:

# Running the function w/ a example website + prompt
result = web_capture_and_extract("https://vd7.io/experience", "Extract this dude's Experience info")
print(result)

You should see two things happen:

console output

Part 3: "AutoGPT" style prompting + Bing search

Chat with GPT-4V Web Agent in realtime to guide it across Bing search.

Run node web_agent.js :

🔥 GPT-4V Web Agent: Sup, ask me something!
You: 

For example:

chat with web agent

which matches the trending cryptos list on CoinMarketCap:

via CoinMarketCap

Here's the extended convo 😂 :

(base) vdutts7@Vacbook-Vro gpt4V-scraper % node web_agent.js 
🔥 GPT-4V Web Agent: Sup, ask me something!
You: gimme the top 10 trending cryptos right now

GPT: {"url": "https://coinmarketcap.com/trending-cryptocurrencies/"}
Crawling 🐜  https://coinmarketcap.com/trending-cryptocurrencies/
GPT: The top 10 trending cryptocurrencies on CoinMarketCap right now are:

1. Bonk (BONK)
2. Loopring (LRC)
3. Internet Computer (ICP)
4. Cirus Foundation (CIRUS)
5. Coq Inc (COQ)
6. Shiba Inu (SHIB)
7. SATS (100SATs)
8. Worldcoin (WLD)
9. r a t s (Ordinals) (rats)
10. Bitcoin (BTC)

Please note that cryptocurrency markets are highly volatile, and the trending list can change frequently.
You: which ones looks smexy

GPT: It's important to clarify that the term "smexy," which is often a colloquial or slang term for "smart and sexy," doesn't really apply to cryptocurrencies. Cryptocurrencies are digital or virtual currencies and don't possess physical attributes that can be defined as attractive or not in the way that term suggests.

However, if you're asking about which cryptocurrencies on the list are potentially interesting or have seen significant attention, people often consider a few factors such as market performance, innovation, and the presence of a strong community or technological potential behind the cryptocurrency.

If we look at the trend data provided and the percentage changes in price over the past 7 days from the snapshot:

1. Bonk (BONK) has seen a remarkable 613.52% increase over 7 days.
2. Cirus Foundation (CIRUS) has grown by 107.72% over the same time frame.
3. Worldcoin (WLD) has appreciated by 105.97% over the last 7 days.

These significant increases might signal market excitement around these tokens, suggesting that some traders may find these trends to be metaphorically "smexy."

However, this should not be considered investment advice. Cryptocurrency investments can be highly speculative and carry a high level of risk. It's important to conduct thorough research or consult a financial advisor before making investment decisions.
You: 

🔧Tools Used

GPT4Vision Puppeteer

👤Contact

Email Twitter