Skip to content

Instantly share code, notes, and snippets.

View hujili007's full-sized avatar

hujili hujili007

View GitHub Profile
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
from reportlab.lib.pagesizes import A4
from reportlab.lib.units import inch
from reportlab.pdfgen import canvas
def split_text_into_chunks(text, num_chunks):
"""Split the text into specified number of chunks."""
lines_per_chunk = len(text) // num_chunks
return [text[i * lines_per_chunk:(i + 1) * lines_per_chunk] for i in range(num_chunks - 1)] + [text[(num_chunks - 1) * lines_per_chunk:]]
@hujili007
hujili007 / run_openai_assistants.py
Created November 10, 2023 03:23 — forked from breezedeus/run_openai_assistants.py
A simple script to run the newest OpenAI Assistants Functions.
# coding: utf-8
# !pip install -U openai
import time
from copy import deepcopy
import openai
from openai._types import NOT_GIVEN
openai.api_key = '<YOUR_API_KEY>'