File size: 1,069 Bytes
9440a53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7d350a1
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
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()