Spaces:
Sleeping
Sleeping
File size: 654 Bytes
759dc9e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
import os
import openai
openai.api_key="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"
start="\nAI"
End="\Human
Prompt="This is AI Chat bot for the Student Consulting"
def OpneaiFun(Prompt):
respone=openai.Completion.create(
model="text-davinci-003",
prompt=Prompt,
temperature=0.9,
max_tokens=150,
top_p=1,
frequency_penalty=0,
presence_penalty=0.5,
stop=["Human:","AI:"]
)
return respone.choices[0].text
def chat_clone(input,history):
history=history or []
s=list(sum(history,()))
s.append(input)
inp=' '.join(s)
output=OpneaiFun(inp)
history.append((input,output))
return history,history
|