Created
February 11, 2023 17:30
-
-
Save danielgross/786bd07742176a6c6297a93c50a6434a to your computer and use it in GitHub Desktop.
Add as final cell to notebook for easy transition to OpenAI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~~~magictext~~~ | |
# update FILENAME to your file name | |
!jupyter nbconvert --to script --output "/tmp/copy" FILENAME.ipynb | |
# Trim empty lines from /tmp/copy.py | |
!sed -i '' '/^$/d' /tmp/copy.py | |
# Trim lines that start with "# In[" | |
!sed -i '' '/^# In\[/d' /tmp/copy.py | |
# Remove this very section, e.g. anything after "# ~~~magictext~~~" | |
!sed -i '' '/# ~~~magictext~~~/,$d' /tmp/copy.py | |
!cat /tmp/copy.py | pbcopy | |
# And then focus the Chrome window on the OpenAI tab | |
model_id = "text-davinci-003" | |
!osascript -e 'tell application "Google Chrome" to tell the active tab of its first window to set URL to "https://platform.openai.com/playground?model=%s"' % model_id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
went back to find this on twitter but couldn't find it, glad that I opened this when it was first tweeted (found it in my ~100 open tabs). Thanks for this!
Question - what's the reason for the switch to OpenAI playground once the .py file is ready?