--- title: thread-gpt app_file: app.py sdk: gradio sdk_version: 4.4.1 ---

ThreadGPT

ThreadGPT Logo

Struggling to keep up with the latest AI research papers? **ThreadGPT** is here to help. It seamlessly transforms complex academic papers into concise, easy-to-understand threads. Not only does it summarize the text, but it also includes relevant figures, tables, and visuals from the papers directly into the threads. ๐Ÿงตโœจ๐Ÿ“„

Gradio UI
Gradio App UI

Example Threads
Examples of threads generated by ThreadGPT (@paper_threadoor)

## ๐Ÿ› ๏ธ Installation ### Clone the repo ```bash git clone https://github.com/wiskojo/thread-gpt ``` ### Install dependencies ```bash # Install PyTorch, torchvision, and torchaudio # Please refer to the official PyTorch website (https://pytorch.org) for the installation command that matches your system. Example: pip install torch==2.0.0 torchvision==0.15.1 # Install all other dependencies pip install -r requirements.txt ``` ### Configure environment variables Copy the `.env.template` file and fill in your `OPENAI_API_KEY`. ```bash cp .env.template .env ``` ## ๐Ÿš€ Getting Started Before proceeding, please ensure that all the installation steps have been successfully completed. ### ๐Ÿšจ Cost Warning Please be aware that usage of GPT-4 with the assistant API can incur high costs. Make sure to monitor your usage and understand the pricing details provided by OpenAI before proceeding. ### Gradio ```bash python app.py ``` ### CLI #### ๐Ÿงต Create Thread To create a thread, you can either provide a URL to a file or a local path to a file. Use the following commands: ```bash # For a URL python thread.py # For a local file python thread.py ``` By default, you will find all outputs under `./data/`. It will have the following structure. ``` ./data// โ”œโ”€โ”€ figures/ โ”‚ โ”œโ”€โ”€ .jpg โ”‚ โ”œโ”€โ”€ .png โ”‚ โ””โ”€โ”€ ... โ”œโ”€โ”€ .pdf โ”œโ”€โ”€ results.json โ”œโ”€โ”€ thread.json โ”œโ”€โ”€ processed_thread.json โ””โ”€โ”€ processed_thread.md ``` The final output for user consumption is located at `./data//processed_thread.md`. This file is formatted in Markdown and can be conveniently viewed using any Markdown editor. #### All Contents 1. `figures/`: This directory contains all the figures, tables, and visuals that have been extracted from the paper. 2. `.pdf`: This is the original PDF file. 3. `results.json`: This file contains the results of the layout parsing. It includes an index of all figures, their paths, and captions that were passed to OpenAI. 4. `thread.json`: This file contains the raw thread that was generated by OpenAI before any post-processing was done. 5. `processed_thread.json`: This file is a post-processed version of `thread.json`. The post-processing includes steps such as removing source annotations and duplicate figures. 6. `processed_thread.md`: This is a markdown version of `processed_thread.json`. It is the final output provided for user consumption. #### ๐Ÿ“จ Share Thread To actually share the thread on X/Twitter, you need to set up the credentials in the `.env` file. This requires creating a [developer account](https://developer.twitter.com/) and filling in your `CONSUMER_KEY`, `CONSUMER_SECRET`, `ACCESS_KEY`, and `ACCESS_SECRET`. Then run this command on the created JSON file: ```bash python tweet.py ./data//processed_thread.json ``` #### ๐Ÿ”ง Customize Assistant ThreadGPT utilizes OpenAI's assistant API. To customize the assistant's behavior, you need to modify the `create_assistant.py` file. This script has defaults for the prompt, name, tools, and model (`gpt-4-1106-preview`). You can customize these parameters to your liking.