


Cursor integrated with GPT-4 makes writing code as easy as chatting. A new era of coding in natural language has arrived.
Github Copilot X integrating GPT-4 is still in small-scale internal testing, while Cursor integrating GPT-4 has been publicly released. Cursor is an IDE that integrates GPT-4 and can write code in natural language, making writing code as easy as chatting.
There is still a big difference between GPT-4 and GPT-3.5 in their ability to process and write code. A test report from the official website.
The first two are GPT-4, one uses text input and the other uses image input; the third one is GPT3.5, which shows the coding capabilities of GPT-4 Compared with GPT-3.5, it has greater capabilities.
Github Copilot X integrating GPT-4 is still in small-scale testing, while Cursor integrating GPT-4 has been publicly released. Cursor is an IDE that integrates GPT-4 and can write code in natural language, making writing code as easy as chatting.
Integrated GPT-4 Cursor, shortcut keys: ctrl k on windows computer, comand k on mac computer to evoke the requirement input box to write code in natural language; ctrl l, comand l to evoke the chat window to write code and Chatting is just as easy.
First, press ctrl k. Write down a requirement: write a python program that converts pictures into characters and pictures and writes them into files. You need to use the pillow library. The araparse library
cursor is in a blank space. In the file, a complete python code is generated.
# Welcome to Cursor
# 1. Try generating with command K on a new line. Ask for a pytorch script of a feedforward neural network
# 2. Then, select the outputted code and hit chat. Ask if there's a bug. Ask how to improve.
# 3. Try selecting some code and hitting edit. Ask the bot to add residual layers.
# 4. To try out cursor on your own projects, go to the file menu (top left) and open a folder.
from PIL import Image
import argparse
# Command line input parameter processing
parser = argparse.ArgumentParser()
parser.add_argument('file') #Input file
parser.add_argument('-o', '--output' ) # Output file
parser.add_argument('--width', type = int, default = 80) # Output character width
parser.add_argument('--height', type = int, default = 80 ) # Output character drawing height
# Get parameters
args = parser.parse_args()
IMG = args.file
WIDTH = args.width
HEIGHT = args .height
OUTPUT = args.output
# The character set used for character painting, a total of 70 characters, can be extended by yourself
ascii_char = list("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&* ()_ -=[]{};':",./?\|`~ ")
# Map 256 grayscale to 70 characters
def get_char( r, g, b, alpha = 256):
if alpha == 0:
return ' '
length = len(ascii_char)
gray = int(0.2126 * r 0.7152 * g 0.0722 * b)
unit = (256.0 1)/length
return ascii_char[int(gray/unit)]
if __name__ == '__main__':
im = Image. open(IMG)
im = im.resize((WIDTH, HEIGHT), Image.NEAREST)
txt = ""
for i in range(HEIGHT):
for j in range(WIDTH):
txt = get_char(*im.getpixel((j, i)))
txt = 'n'
print(txt)
# Output character drawing to file
if OUTPUT:
with open(OUTPUT, 'w') as f:
f.write(txt)
else:
with open("output .txt", 'w') as f:
f.write(txt)
See if the automatically generated code can be run directly.
Select the following image for conversion:
(venv) PS C:UsershanweiPycharmProjectspythonProject> python .main.py -h
usage : main.py [-h] [-o OUTPUT] [--width WIDTH] [--height HEIGHT] file
positional arguments:
file
options:
-h, --helpshow this help message and exit
-o OUTPUT, --output OUTPUT
--width WIDTH
--height HEIGHT
(venv) PS C:UsershanweiPycharmProjectspythonProject> python .main .py .golang.png
After running the program, the conversion effect is as follows:
Let’s read the code below:
gray = int(0.2126 * r 0.7152 * g 0.0722 * b)
This code is so strange, ask what Cursor means. Press ctrl l to bring up the chat window and enter: What does this code mean
Cursor gave an explanation. It turns out that the gray value is calculated by weighting the values of r, g, and b, and then the characters are calculated through the gray value. A reference link is also given https://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale
Press ctrl l to bring up the chat window and let AI explains the entire code, enter: Explain the entire code in Chinese
It can be seen that the AI explanation is very accurate and detailed.
The function of the above code is to convert the picture into a black and white ASCII character painting with gray scale. Let's transform it so that it can generate colorful character painting.
Press ctrl k to wake up the demand text box and enter: Please change this code from generating black and white characters to generating colored characters
See Animation: AI will scan each line of code line by line, mark the areas that need to be changed, and then provide the changed code below. And keep the original code for easy comparison.
The AI only changed 2 lines of code (actually only one line was changed, the second AI may have short-circuited its brain, completely equivalent changes), and achieved the The generation of black and white characters is changed to the generation of color characters. Test it below:
(venv) PS C:UsershanweiPycharmProjectspythonProject> python .main2.py .golang.png
The generated results are as follows. It is found that after the text file is opened, there is a lot more color information
Open the text file directly to view, but the original image cannot be seen. You need to view the color effect in the terminal:
It can be seen that the blue information of the original picture is displayed, and two different shades of blue are displayed. Perfect!
The above is the detailed content of Cursor integrated with GPT-4 makes writing code as easy as chatting. A new era of coding in natural language has arrived.. For more information, please follow other related articles on the PHP Chinese website!

Running large language models at home with ease: LM Studio User Guide In recent years, advances in software and hardware have made it possible to run large language models (LLMs) on personal computers. LM Studio is an excellent tool to make this process easy and convenient. This article will dive into how to run LLM locally using LM Studio, covering key steps, potential challenges, and the benefits of having LLM locally. Whether you are a tech enthusiast or are curious about the latest AI technologies, this guide will provide valuable insights and practical tips. Let's get started! Overview Understand the basic requirements for running LLM locally. Set up LM Studi on your computer

Guy Peri is McCormick’s Chief Information and Digital Officer. Though only seven months into his role, Peri is rapidly advancing a comprehensive transformation of the company’s digital capabilities. His career-long focus on data and analytics informs

Introduction Artificial intelligence (AI) is evolving to understand not just words, but also emotions, responding with a human touch. This sophisticated interaction is crucial in the rapidly advancing field of AI and natural language processing. Th

Introduction In today's data-centric world, leveraging advanced AI technologies is crucial for businesses seeking a competitive edge and enhanced efficiency. A range of powerful tools empowers data scientists, analysts, and developers to build, depl

This week's AI landscape exploded with groundbreaking releases from industry giants like OpenAI, Mistral AI, NVIDIA, DeepSeek, and Hugging Face. These new models promise increased power, affordability, and accessibility, fueled by advancements in tr

But the company’s Android app, which offers not only search capabilities but also acts as an AI assistant, is riddled with a host of security issues that could expose its users to data theft, account takeovers and impersonation attacks from malicious

You can look at what’s happening in conferences and at trade shows. You can ask engineers what they’re doing, or consult with a CEO. Everywhere you look, things are changing at breakneck speed. Engineers, and Non-Engineers What’s the difference be

Simulate Rocket Launches with RocketPy: A Comprehensive Guide This article guides you through simulating high-power rocket launches using RocketPy, a powerful Python library. We'll cover everything from defining rocket components to analyzing simula


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Atom editor mac version download
The most popular open source editor