Hey there,
I wanted to use the OpenAI image generation so I created a simple Python script. Everything works fine, but instead of only outputting the link, I want it to open in my browser so I don’t always have to copy and paste the link. This is the code I have:
import os
import openai
import sys
import webbrowser
prompt01 = input("Enter Text: ")
openai.api_key = "MYKEY"
response = openai.Image.create(
prompt=prompt01,
n=1,
size="1024x1024",
)
#d = "temp.txt"
f = open(d,'w')
print(response["data"][0]["url"], file=f)
#with open('temp.txt', 'r') as file:
# temptext = file.read().rstrip()
#temptext01 = temptext
#webbrowser.open_new_tab(temptext01)
Is there any way of doing this? (the excluded code and unused imports are from trying to solve it myself which obviously didn’t work)
-Thanks!