Spaces:
Running
Running
File size: 346 Bytes
9e822e4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
from openai import OpenAI
from dotenv import load_dotenv
import os
load_dotenv()
class OpenAIFileUpload:
def __init__(self):
self.client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
def upload_image(self, image, purpose) -> str:
file = self.client.files.create(file=image, purpose=purpose)
return file.id
|