sarangs commited on
Commit
9440a53
1 Parent(s): a7965d9

First Round

Browse files
Files changed (2) hide show
  1. app.py +31 -0
  2. requirements.txt +2 -0
app.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import openai
2
+ import gradio as gr
3
+
4
+ openai.api_key = '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'
5
+
6
+ def openai_chat(prompt):
7
+ completions = openai.Completion.create(
8
+ engine="text-davinci-003",
9
+ prompt=prompt,
10
+ max_tokens=1024,
11
+ n=1,
12
+ temperature=0.5,
13
+ )
14
+
15
+ message = completions.choices[0].text
16
+ return message.strip()
17
+
18
+ def chatbot(input, history=[]):
19
+ output = openai_chat(input)
20
+ history.append((input, output))
21
+ return history, history
22
+
23
+ title = "Usefulness of emerging technologies in formal foreign language education"
24
+
25
+ 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)."
26
+
27
+ gr.Interface(fn = chatbot,
28
+ inputs = ["text",'state'],
29
+ outputs = ["chatbot",'state'],
30
+ title=title,
31
+ description=description).launch(debug = True, share=True)
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ gradio==3.16.0
2
+ openai==0.25.0