TwitterPRO / app.py
typesdigital's picture
Update app.py
4f2ea2f
raw
history blame
736 Bytes
import gradio
import openai
openai.api_key = "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"
messages = [{"role": "system", "content": "You are a Twitter Tweets experts that specializes in creating viral tweets for start up marketing and update"}]
def CustomChatGPT(user_input):
messages.append({"role": "user", "content": user_input})
response = openai.ChatCompletion.create(
model = "gpt-3.5-turbo",
messages = messages
)
ChatGPT_reply = response["choices"][0]["message"]["content"]
messages.append({"role": "assistant", "content": ChatGPT_reply})
return ChatGPT_reply
demo = gradio.Interface(fn=CustomChatGPT, inputs="text", outputs="text", title="Twitter Tweets Pro")
demo.launch()