Spaces:
Runtime error
Runtime error
Commit
·
2884a24
1
Parent(s):
fd0cd09
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,8 +5,17 @@ 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(message):
|
| 9 |
messages.append({"role": "user", "content": message})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
response = openai.ChatCompletion.create(
|
| 11 |
model="gpt-3.5-turbo",
|
| 12 |
messages=messages
|
|
@@ -16,4 +25,4 @@ def CustomChatGPT(message):
|
|
| 16 |
return ChatGPT_reply
|
| 17 |
|
| 18 |
demo = gr.Interface(fn=CustomChatGPT, inputs="text", outputs="text", title="Twitter Tweets Pro", inputs_label="Enter a message")
|
| 19 |
-
demo.launch()
|
|
|
|
| 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(message, alternative_inputs=True):
|
| 9 |
messages.append({"role": "user", "content": message})
|
| 10 |
+
|
| 11 |
+
if alternative_inputs:
|
| 12 |
+
alternative_messages = [
|
| 13 |
+
{"role": "user", "content": "What are the best strategies for startup marketing?"},
|
| 14 |
+
{"role": "user", "content": "How can I increase engagement on Twitter?"},
|
| 15 |
+
{"role": "user", "content": "Any tips for creating viral tweets?"}
|
| 16 |
+
]
|
| 17 |
+
messages.extend(alternative_messages)
|
| 18 |
+
|
| 19 |
response = openai.ChatCompletion.create(
|
| 20 |
model="gpt-3.5-turbo",
|
| 21 |
messages=messages
|
|
|
|
| 25 |
return ChatGPT_reply
|
| 26 |
|
| 27 |
demo = gr.Interface(fn=CustomChatGPT, inputs="text", outputs="text", title="Twitter Tweets Pro", inputs_label="Enter a message")
|
| 28 |
+
demo.launch()
|