Skip to content

Commit

Permalink
Merge pull request younesbram#2 from younesbram/GPT-3.5-turbo
Browse files Browse the repository at this point in the history
Upgraded to gpt-3.5-turbo with few-shot training on chat completion
  • Loading branch information
younesbram authored Mar 10, 2023
2 parents 0c10bba + afaebdd commit 536eef8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,24 @@ How to use :
2. Attach your openai api key on client side or in env
3. python serenitynow.py => enter any topic you'd like a seinfeld skit/joke on

## TODO-asap
yea so sometimes if the output is too long it bugs out the tortoise input. will fix

I use :
## Tech Stack

OpenAI===text-davinci003
OpenAI===gpt-3.5-turbo
TorToiSe==2.4.2
Conda Env
Conda Environment
Python / Pip
More soon

## To collab
please fork and follow general PR rules.

## Intro:
The Seinfeld-Talkabot is a project that utilizes OpenAI's davinci003 model and the TorToiSe library to generate audio files of Seinfeld characters speaking user-provided text. The goal of the project is to showcase the potential of such apps, which could be used for a variety of purposes, including generating accurate and authentic-sounding audiobooks using prompt engineering and TorToiSe, or translating and dubbing content using the GPT-3 model while maintaining the original voice. By demonstrating the capabilities of these technologies, the Seinfeld-Talkabot aims to inspire further innovation in the field of natural language processing and audio generation.
The Seinfeld-Talkabot is a project that utilizes OpenAI's gpt-3.5-turbo model and the TorToiSe library to generate audio files of Seinfeld characters speaking user-provided text. The goal of the project is to showcase the potential of such apps, which could be used for a variety of purposes, including generating accurate and authentic-sounding audiobooks using prompt engineering and TorToiSe, or translating and dubbing content using the GPT-3 model while maintaining the original voice. By demonstrating the capabilities of these technologies, the Seinfeld-Talkabot aims to inspire further innovation in the field of natural language processing and audio generation.


## Todo:
Create any kind of frontend to interact with backend of selecting a topic (Text input) => davinci003 generate a script => api call to TorToiSe + pyfastmp3encoder to generate a .wav file with the selected seinfeld character voice. Currently supporting jerry seinfelds voice from his audiobook + wav files from the seinfeld show itself.
Create any kind of frontend to interact with backend of selecting a topic (Text input) => turbogpt3.5 generate a script => api call to TorToiSe + pyfastmp3encoder to generate a .wav file with the selected seinfeld character voice. Currently supporting jerry seinfelds voice from his audiobook + wav files from the seinfeld show itself.

## Ethical Promises
This project is just to showcase the potential of such apps. Hopefully in the future we will have a more clear guideline on ethically using applications such as this. I hope I gave enough credit where due. Please let me know of any issues [email protected]
Expand Down
28 changes: 17 additions & 11 deletions serenitynow.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,29 @@
import subprocess
import uuid

openai.api_key = YOUR_OPENAI_KEY_API
openai.api_key = YOUR_API_KEY
# Get user input for the topic
topic = input("Enter a topic: ")

# Generate text using OpenAI's GPT-3 API
prompt = f"Generate a topic about {topic} described by a sarcastic Jerry Seinfeld and give the text."
response = openai.Completion.create(
engine="text-davinci-003",
prompt=prompt,
max_tokens=2048,
n=1,
stop=None,
temperature=0.6,
# A faked few-shot conversation to prime the model into becoming a sarcastic seinfeld
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": "You are an assistant tasked with making Jerry Seinfeld jokes. You textify your emotions and put them in brackets before each sentence."},
{"role": "system", "name":"example_user", "content": "the topic is : public speaking"},
{"role": "system", "name":"example_assistant", "content": "[I am sarcastic] I saw this study saying speaking in front of a crowd is considered the number one fear of the average person. I found that amazing. [I am sarcastic and surprised] Number two.. was death. [I am surprised and sarcastic] Death is number two?! [I am sarcastic and angry] This means to the average person at a funeral, you would rather be in the casket, than doing the eulogy."},
{"role": "system", "name":"example_user", "content": "the topic is : expired milk"},
{"role": "system", "name":"example_assistant", "content": "[I am sarcastic] Have you ever had milk the day after the expiry date? Scares the hell out of you, doesn't it. [I am scared and sarcastic] It's after the day! I'm taking a really big chance here! [I am sarcastic and excited] Makes you wonder, how are the dates exact? Maybe the cows tip them off when they're milking them."},
{"role": "system", "name":"example_user", "content": "That was perfect! Great job jerry."},
{"role": "system", "name":"example_assistant", "content": "Thank you! It was a pleasure to deliver a sarcastic take on the topic."},
{"role": "user", "content": f"the topic is : {topic}."},
],
temperature=0.666,
)


# Get the generated text from the response
generated_text = response.choices[0].text.strip()
generated_text = response['choices'][0]['message']['content']
print(generated_text)


Expand Down

0 comments on commit 536eef8

Please sign in to comment.