Gopala Krishna commited on
Commit
8959db0
·
1 Parent(s): bcd645c

initial commit

Browse files
.vs/MyChatGPTDavinci/FileContentIndex/130d1346-c840-4d43-8381-dbd11d368446.vsidx ADDED
Binary file (4.84 kB). View file
 
.vs/MyChatGPTDavinci/FileContentIndex/8d83fdbd-5622-4d2c-81a8-1e26ffefcaea.vsidx ADDED
Binary file (271 Bytes). View file
 
.vs/MyChatGPTDavinci/FileContentIndex/c402d78c-6bea-4b30-a2b5-402190f54051.vsidx ADDED
Binary file (127 Bytes). View file
 
.vs/MyChatGPTDavinci/FileContentIndex/read.lock ADDED
File without changes
.vs/MyChatGPTDavinci/v17/.wsuo ADDED
Binary file (27.6 kB). View file
 
.vs/VSWorkspaceState.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "ExpandedNodes": [
3
+ ""
4
+ ],
5
+ "SelectedNode": "\\C:\\Python\\Programs\\Gradio\\HuggingSpace\\MyChatGPTDavinci",
6
+ "PreviewInSolutionExplorer": false
7
+ }
.vs/slnx.sqlite ADDED
Binary file (90.1 kB). View file
 
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import openai
3
+ import gradio as gr
4
+
5
+ openai.api_key = "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"
6
+
7
+ messages = [
8
+ {"role": "system", "content": "My AI Assistant."},
9
+ ]
10
+
11
+ def chatbot(input):
12
+ if input:
13
+ messages.append({"role": "user", "content": input})
14
+ prompt = "\n".join([f"{m['role']}: {m['content']}" for m in messages])
15
+ chat = openai.Completion.create(
16
+ engine="text-davinci-003", prompt=prompt, max_tokens=1024, n=1, stop=None, temperature=0.7
17
+ )
18
+ reply = chat.choices[0].text.strip()
19
+ messages.append({"role": "assistant", "content": reply})
20
+ return reply
21
+
22
+ inputs = gr.inputs.Textbox(lines=7, label="Query")
23
+ outputs = gr.outputs.Textbox(label="Response")
24
+
25
+ gr.Interface(fn=chatbot, inputs=inputs, outputs=outputs, title="My ChatGPT",
26
+ theme="compact").launch()
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ openai