File size: 498 Bytes
3161eae
 
 
 
 
 
 
 
 
 
 
 
 
87451e6
3161eae
 
 
 
 
 
7cd92f7
acd96dd
3161eae
 
87451e6
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
import gradio as gr
import time
ko2enDict = {
    "사과":"apple",
    "μ‚¬μž":"lion",
    "μ‚¬λž‘":"love"
}
en2koDict = {
    "apple":"사과",
    "lion":"μ‚¬μž",
    "love":"μ‚¬λž‘"
}
dict = {"ko2en":ko2enDict, "en2ko":en2koDict}
def trans(type, word):
  return dict[type][word]

app = gr.Interface(
    fn=trans,
    inputs=[gr.Radio(["ko2en", "en2ko"]), gr.Textbox(placeholder="검색어")],
    outputs="text",
    examples=[["ko2en", "μ‚¬μž"]],
    allow_flagging="auto"
)

app.launch()