EEA_chatbot / app.py
sarangs's picture
Update app.py
7d350a1
import openai
import gradio as gr
openai.api_key = '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'
def openai_chat(prompt):
completions = openai.Completion.create(
engine="text-davinci-003",
prompt=prompt,
max_tokens=1024,
n=1,
temperature=0.5,
)
message = completions.choices[0].text
return message.strip()
def chatbot(input, history=[]):
output = openai_chat(input)
history.append((input, output))
return history, history
title = "Usefulness of emerging technologies in formal foreign language education"
description = "The project will explore the usefulness of latest emerging technologies, such as machine learning, deep learning, and natural language processing (NLP) in education, various forms of artificial intelligence, or augmented reality, in the process of foreign language education (FLE)."
gr.Interface(fn = chatbot,
inputs = ["text",'state'],
outputs = ["chatbot",'state'],
title=title,
description=description).launch()