TwitterPRO / app.py
typesdigital's picture
Update app.py
9bfd3fd
raw
history blame
696 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 startup 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()