Update app2.py
Browse files
app2.py
CHANGED
|
@@ -61,31 +61,3 @@ gr.Interface(fn=chatbot, inputs=inputs, outputs=outputs, title="The AI Patch & S
|
|
| 61 |
|
| 62 |
#import openai
|
| 63 |
#import gradio as gr
|
| 64 |
-
"""
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
openai.api_key = "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"
|
| 68 |
-
|
| 69 |
-
messages = [
|
| 70 |
-
{"role": "system", "content": "You are a chatbot that is very happy and kind."},
|
| 71 |
-
]
|
| 72 |
-
|
| 73 |
-
def chatbot(input):
|
| 74 |
-
if input:
|
| 75 |
-
messages.append({"role": "user", "content": input})
|
| 76 |
-
chat = openai.ChatCompletion.create(
|
| 77 |
-
#model="gpt-3.5-turbo", messages=messages
|
| 78 |
-
model="gpt-4", messages=messages
|
| 79 |
-
)
|
| 80 |
-
reply = chat.choices[0].message.content
|
| 81 |
-
messages.append({"role": "assistant", "content": reply})
|
| 82 |
-
return reply
|
| 83 |
-
|
| 84 |
-
inputs = gr.Textbox(lines=7, label="Chat with AI")
|
| 85 |
-
outputs = gr.Textbox(label="Reply - NEW")
|
| 86 |
-
|
| 87 |
-
gr.Interface(fn=chatbot, inputs=inputs, outputs=outputs, title="The AI Patch & Sparks Chatbot",
|
| 88 |
-
description="Ask anything you want about Patch&Sparks - - - -yeah",
|
| 89 |
-
theme="compact").launch(share=True)
|
| 90 |
-
|
| 91 |
-
"""
|
|
|
|
| 61 |
|
| 62 |
#import openai
|
| 63 |
#import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|