l***[email protected]
2023-03-18 04:45 deepin
errors occuredseveral times due to model maximum content reached to the limit 4097 token, not sure it's limitation of gradios or GPI key, will find out later. anyway the experiences are quite pleasant, by zero cost. Very nice learning jouney. Deepin is stable.
the new AI chat bot link see below, it's dynamic address. I do hope can find a way to get permanent address soon. Running on public URL
Reply Like 0 View the author
菜鸟第一次,成功在Deepin使用Python/openAI创建属于自己的 ChatGPI3.5聊天机器人 - 完全免费
today 3.17.2023 Friday, I created my First AI chatbot using openAI under Deepin in 20 minutes, it works perfectly well, for both English and Chinese.
see below
I'm using deepin 20.8 with installed python 3.7, under terminal I installed below pip3, openAI, gradio:
$ python3 -m pip install -U pip
$ pip3 install openai
$ pip3 install gradio
(that takes me less than 10 minutes)
obtained my first API key by individual registration
installed notepad++ txteditor from deepin store,
created my first app.py (that takes me less than 2 minutes)
===template===
import openai
import gradio as gr
openai.api_key = "Your API key"
messages = [
{"role": "system", "content": "You are a helpful and kind AI Assistant."},
]
def chatbot(input):
if input:
messages.append({"role": "user", "content": input})
chat = openai.ChatCompletion.create(
model="gpt-3.5-turbo", messages=messages
)
reply = chat.choices[0].message.content
messages.append({"role": "assistant", "content": reply})
return reply
inputs = gr.inputs.Textbox(lines=7, label="Chat with AI")
outputs = gr.outputs.Textbox(label="Reply")
gr.Interface(fn=chatbot, inputs=inputs, outputs=outputs, title="AI Chatbot",
description="Ask anything you want",
theme="compact").launch(share=True)
====end===
run it, python3 /............app.py, post to local test in browser, in different app, by both Chinese and English, works perfectly well. Thanks BeeBom.
Glad to announce that, my 1st person AI chat bot is alive by using Deepin, i created all in 30 minutes, all free, feel free to use it, will be alive in 72 hours every launch