egoing commited on
Commit
64f613e
·
1 Parent(s): 01d1b29

최초 커밋

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ ko2enDict = {"사랑": "love", "사자": "lion", "사과": "apple"}
4
+ en2koDict = {"love": "사랑", "lion": "사자", "apple": "사과"}
5
+ dict = {"ko2en": ko2enDict, "en2ko": en2koDict}
6
+
7
+
8
+ def trans(type, word):
9
+ return dict[type][word]
10
+
11
+
12
+ app = gr.Interface(
13
+ fn=trans,
14
+ inputs=[
15
+ gr.Radio(choices=["ko2en", "en2ko"]),
16
+ gr.Textbox(value="사랑", info="한국어를 입력하세요"),
17
+ ],
18
+ outputs="text",
19
+ examples=[["ko2en", "사랑"], ["en2ko", "love"]],
20
+ theme=gr.themes.Glass(),
21
+ allow_flagging="manual",
22
+ )
23
+ app.launch(debug=True, share=True)