[Share Experiences] 成功在Deepin使用Python/openAI创建ChatGPI3.5聊天机器人
Tofloor
poster avatar
l***[email protected]
deepin
2023-03-18 01:30
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

Reply Favorite View the author
All Replies
l***[email protected]
deepin
2023-03-18 04:45
#1

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 View the author
青稚°
Moderator
2023-03-18 11:47
#2

like

Reply View the author
l***[email protected]
deepin
2023-03-21 06:25
#3
It has been deleted!
l***[email protected]
deepin
2023-03-21 06:42
#4
It has been deleted!
l***[email protected]
deepin
2023-03-21 06:44
#5
It has been deleted!
l***[email protected]
deepin
2023-03-23 05:58
#6
It has been deleted!
l***[email protected]
deepin
2023-03-24 01:26
#7
l***[email protected] It has been deleted!

image.png

Reply View the author
l***[email protected]
deepin
2023-03-26 03:59
#8

https://chat.openai.com/chat is free and open for everyone, driven by up-to-date model, however I will continously learn how to improve personal AI bot, first thing I want to do is enabling gTTs

Reply View the author
l***[email protected]
deepin
2023-04-08 20:08
#9

从零开始学习的菜鸟,偷懒向GPT请教,效果还不错

image.png

Reply View the author
l***[email protected]
deepin
2023-04-14 07:08
#10
It has been deleted!
y***[email protected]
deepin
2023-05-22 23:05
#11
It has been deleted!
p***[email protected]
deepin
2023-06-15 18:16
#12
It has been deleted!