Spaces:
Running
Running
Commit
·
5daa1b3
1
Parent(s):
79c0491
Delete chatgpt-clone-main
Browse files- chatgpt-clone-main/LICENSE +0 -21
- chatgpt-clone-main/README.md +0 -16
- chatgpt-clone-main/app.py +0 -55
- chatgpt-clone-main/requirements.txt +0 -2
chatgpt-clone-main/LICENSE
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
MIT License
|
2 |
-
|
3 |
-
Copyright (c) 2022 amrrs
|
4 |
-
|
5 |
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
-
of this software and associated documentation files (the "Software"), to deal
|
7 |
-
in the Software without restriction, including without limitation the rights
|
8 |
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
-
copies of the Software, and to permit persons to whom the Software is
|
10 |
-
furnished to do so, subject to the following conditions:
|
11 |
-
|
12 |
-
The above copyright notice and this permission notice shall be included in all
|
13 |
-
copies or substantial portions of the Software.
|
14 |
-
|
15 |
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21 |
-
SOFTWARE.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
chatgpt-clone-main/README.md
DELETED
@@ -1,16 +0,0 @@
|
|
1 |
-
# chatgpt-clone
|
2 |
-
Build Yo'own ChatGPT with OpenAI API & Gradio
|
3 |
-
|
4 |
-
### Instructions:
|
5 |
-
|
6 |
-
1. Get your OpenAI API key here - https://beta.openai.com/account/api-keys
|
7 |
-
2. Replace that key in the `app.py` code
|
8 |
-
3. Install the required libraries `pip install -r requirements.txt`
|
9 |
-
4. run `python app.py`
|
10 |
-
|
11 |
-
### Complete Tutorial: https://youtu.be/n5nn3mQxrE8
|
12 |
-
|
13 |
-
### Demo
|
14 |
-
|
15 |
-
https://user-images.githubusercontent.com/5347322/207718196-c5fccff3-1531-4402-99db-fe0fc6bf0e5a.mp4
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
chatgpt-clone-main/app.py
DELETED
@@ -1,55 +0,0 @@
|
|
1 |
-
import os
|
2 |
-
import openai
|
3 |
-
import gradio as gr
|
4 |
-
|
5 |
-
#if you have OpenAI API key as an environment variable, enable the below
|
6 |
-
#openai.api_key = os.getenv("OPENAI_API_KEY")
|
7 |
-
|
8 |
-
#if you have OpenAI API key as a string, enable the below
|
9 |
-
openai.api_key = "xxxxxx"
|
10 |
-
|
11 |
-
start_sequence = "\nAI:"
|
12 |
-
restart_sequence = "\nHuman: "
|
13 |
-
|
14 |
-
prompt = "The following is a conversation with an AI assistant. The assistant is helpful, creative, clever, and very friendly.\n\nHuman: Hello, who are you?\nAI: I am an AI created by OpenAI. How can I help you today?\nHuman: "
|
15 |
-
|
16 |
-
def openai_create(prompt):
|
17 |
-
|
18 |
-
response = openai.Completion.create(
|
19 |
-
model="text-davinci-003",
|
20 |
-
prompt=prompt,
|
21 |
-
temperature=0.9,
|
22 |
-
max_tokens=150,
|
23 |
-
top_p=1,
|
24 |
-
frequency_penalty=0,
|
25 |
-
presence_penalty=0.6,
|
26 |
-
stop=[" Human:", " AI:"]
|
27 |
-
)
|
28 |
-
|
29 |
-
return response.choices[0].text
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
def chatgpt_clone(input, history):
|
34 |
-
history = history or []
|
35 |
-
s = list(sum(history, ()))
|
36 |
-
s.append(input)
|
37 |
-
inp = ' '.join(s)
|
38 |
-
output = openai_create(inp)
|
39 |
-
history.append((input, output))
|
40 |
-
return history, history
|
41 |
-
|
42 |
-
|
43 |
-
block = gr.Blocks()
|
44 |
-
|
45 |
-
|
46 |
-
with block:
|
47 |
-
gr.Markdown("""<h1><center>Build Yo'own ChatGPT with OpenAI API & Gradio</center></h1>
|
48 |
-
""")
|
49 |
-
chatbot = gr.Chatbot()
|
50 |
-
message = gr.Textbox(placeholder=prompt)
|
51 |
-
state = gr.State()
|
52 |
-
submit = gr.Button("SEND")
|
53 |
-
submit.click(chatgpt_clone, inputs=[message, state], outputs=[chatbot, state])
|
54 |
-
|
55 |
-
block.launch(debug = True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
chatgpt-clone-main/requirements.txt
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
openai
|
2 |
-
gradio
|
|
|
|
|
|