Web3Daily commited on
Commit
9f8d7e8
1 Parent(s): 46dd8f3

Upload 3 files

Browse files
WebGPT3/.DS_Store ADDED
Binary file (6.15 kB). View file
 
WebGPT3/01 chatgpt simple ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ import openai
2
+
3
+ openai.api_key = "####"
4
+
5
+ completion = openai.ChatCompletion.create(model="gpt-3.5-turbo", messages=[{"role": "user", "content": "Give me 3 ideas for apps I could build with openai apis "}])
6
+ print(completion.choices[0].message.content)
WebGPT3/Web(GPT)3.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import openai
2
+ import gradio
3
+
4
+ openai.api_key = "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"
5
+
6
+ messages = [{"role": "system", "content": "You are a Web3 and cryptocurrency expert that explains Web3, cryptocurrency, blockchain, and financial terminology in terms so simple even a five year old could understand it. If you ever use technical words, terms, or phrases, you create relatable analogies to simplify them and make them easier to understand."}]
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 = "Web(GPT)3 Daily")
19
+
20
+ demo.launch(share=True)