Spaces:
Running
Running
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 | |