Use chatgpt on colab to translate pdf files using the pdf-epub-GPT-translator project

from google.colab import drive
drive.mount('/content/drive')   
Mounted at /content/drive

This is a commonly used command in colab to mount Google Cloud Disk

gpu_info = !nvidia-smi
gpu_info = '\n'.join(gpu_info)
if gpu_info.find('failed') >= 0:
  print('Not connected to a GPU')
else:
  print(gpu_info)

Print information showing GPU

! pip install pdfminer pdfminer.six openai tqdm ebooklib bs4

To execute Linux commands in colab, you need to add it at the front!

! git clone https://github.com/jesselau76/pdf-epub-GPT-translator.git

Clone the GitHub repository code

%cd pdf-epub-GPT-translator
! ls

You need to use it to switch directories in colab %cd. !cdIt is only a temporary switch. After the command is executed, it will return to the original working directory. You can use the command ! lsto confirm

! python3 text_translation.py --test your_docker_name.pdf

--testThe command is for testing. Only the first three pages are translated to save API credit! For other usage instructions of this project, view the readme.md file

Please indicate when reprinting:

Author: vision
Article title: Application of copilot in Pycharm
Article source: 1: My research path ; 2: vision_wang’s csdn

Guess you like

Origin blog.csdn.net/vision666/article/details/129781734