typesdigital commited on
Commit
f34ae20
·
1 Parent(s): 9bfd3fd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -13
app.py CHANGED
@@ -1,20 +1,19 @@
1
- import gradio
2
  import openai
3
 
4
  openai.api_key = "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"
5
 
6
- messages = [{"role": "system", "content": "You are a Twitter Tweets experts that specializes in creating viral tweets for startup marketing and update"}]
7
 
8
  def CustomChatGPT(user_input):
9
- messages.append({"role": "user", "content": user_input})
10
- response = openai.ChatCompletion.create(
11
- model = "gpt-3.5-turbo",
12
- messages = messages
13
- )
14
- ChatGPT_reply = response["choices"][0]["message"]["content"]
15
- messages.append({"role": "assistant", "content": ChatGPT_reply})
16
- return ChatGPT_reply
17
 
18
- demo = gradio.Interface(fn=CustomChatGPT, inputs="text", outputs="text", title="Twitter Tweets Pro")
19
-
20
- demo.launch()
 
1
+ import gradio as gr
2
  import openai
3
 
4
  openai.api_key = "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"
5
 
6
+ messages = [{"role": "system", "content": "You are a Twitter Tweets expert that specializes in creating viral tweets for startup marketing and updates."}]
7
 
8
  def CustomChatGPT(user_input):
9
+ messages.append({"role": "user", "content": user_input})
10
+ response = openai.ChatCompletion.create(
11
+ model="gpt-3.5-turbo",
12
+ messages=messages
13
+ )
14
+ ChatGPT_reply = response["choices"][0]["message"]["content"]
15
+ messages.append({"role": "assistant", "content": ChatGPT_reply})
16
+ return ChatGPT_reply
17
 
18
+ demo = gr.Interface(fn=CustomChatGPT, inputs="text", outputs="text", title="Twitter Tweets Pro")
19
+ demo.launch()