


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!

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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Some users encountered errors when installing the device, prompting error code 28. In fact, this is mainly due to the driver. We only need to solve the problem of win7 driver code 28. Let’s take a look at what should be done. Do it. What to do with win7 driver code 28: First, we need to click on the start menu in the lower left corner of the screen. Then, find and click the "Control Panel" option in the pop-up menu. This option is usually located at or near the bottom of the menu. After clicking, the system will automatically open the control panel interface. In the control panel, we can perform various system settings and management operations. This is the first step in the nostalgia cleaning level, I hope it helps. Then we need to proceed and enter the system and

Imagine an artificial intelligence model that not only has the ability to surpass traditional computing, but also achieves more efficient performance at a lower cost. This is not science fiction, DeepSeek-V2[1], the world’s most powerful open source MoE model is here. DeepSeek-V2 is a powerful mixture of experts (MoE) language model with the characteristics of economical training and efficient inference. It consists of 236B parameters, 21B of which are used to activate each marker. Compared with DeepSeek67B, DeepSeek-V2 has stronger performance, while saving 42.5% of training costs, reducing KV cache by 93.3%, and increasing the maximum generation throughput to 5.76 times. DeepSeek is a company exploring general artificial intelligence

What to do with blue screen code 0x0000001? The blue screen error is a warning mechanism when there is a problem with the computer system or hardware. Code 0x0000001 usually indicates a hardware or driver failure. When users suddenly encounter a blue screen error while using their computer, they may feel panicked and at a loss. Fortunately, most blue screen errors can be troubleshooted and dealt with with a few simple steps. This article will introduce readers to some methods to solve the blue screen error code 0x0000001. First, when encountering a blue screen error, we can try to restart

In natural language generation tasks, sampling method is a technique to obtain text output from a generative model. This article will discuss 5 common methods and implement them using PyTorch. 1. GreedyDecoding In greedy decoding, the generative model predicts the words of the output sequence based on the input sequence time step by time. At each time step, the model calculates the conditional probability distribution of each word, and then selects the word with the highest conditional probability as the output of the current time step. This word becomes the input to the next time step, and the generation process continues until some termination condition is met, such as a sequence of a specified length or a special end marker. The characteristic of GreedyDecoding is that each time the current conditional probability is the best

The humanoid robot Ameca has been upgraded to the second generation! Recently, at the World Mobile Communications Conference MWC2024, the world's most advanced robot Ameca appeared again. Around the venue, Ameca attracted a large number of spectators. With the blessing of GPT-4, Ameca can respond to various problems in real time. "Let's have a dance." When asked if she had emotions, Ameca responded with a series of facial expressions that looked very lifelike. Just a few days ago, EngineeredArts, the British robotics company behind Ameca, just demonstrated the team’s latest development results. In the video, the robot Ameca has visual capabilities and can see and describe the entire room and specific objects. The most amazing thing is that she can also

The win10 system is a very excellent high-intelligence system. Its powerful intelligence can bring the best user experience to users. Under normal circumstances, users’ win10 system computers will not have any problems! However, it is inevitable that various faults will occur in excellent computers. Recently, friends have been reporting that their win10 systems have encountered frequent blue screens! Today, the editor will bring you solutions to different codes that cause frequent blue screens in Windows 10 computers. Let’s take a look. Solutions to frequent computer blue screens with different codes each time: causes of various fault codes and solution suggestions 1. Cause of 0×000000116 fault: It should be that the graphics card driver is incompatible. Solution: It is recommended to replace the original manufacturer's driver. 2,

Regarding Llama3, new test results have been released - the large model evaluation community LMSYS released a large model ranking list. Llama3 ranked fifth, and tied for first place with GPT-4 in the English category. The picture is different from other benchmarks. This list is based on one-on-one battles between models, and the evaluators from all over the network make their own propositions and scores. In the end, Llama3 ranked fifth on the list, followed by three different versions of GPT-4 and Claude3 Super Cup Opus. In the English single list, Llama3 overtook Claude and tied with GPT-4. Regarding this result, Meta’s chief scientist LeCun was very happy and forwarded the tweet and

Termination Code 0xc000007b While using your computer, you sometimes encounter various problems and error codes. Among them, the termination code is the most disturbing, especially the termination code 0xc000007b. This code indicates that an application cannot start properly, causing inconvenience to the user. First, let’s understand the meaning of termination code 0xc000007b. This code is a Windows operating system error code that usually occurs when a 32-bit application tries to run on a 64-bit operating system. It means it should
