egoing commited on
Commit
3161eae
ยท
1 Parent(s): 6764b5d

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -0
app.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import time
3
+ ko2enDict = {
4
+ "์‚ฌ๊ณผ":"apple",
5
+ "์‚ฌ์ž":"lion",
6
+ "์‚ฌ๋ž‘":"love"
7
+ }
8
+ en2koDict = {
9
+ "apple":"์‚ฌ๊ณผ",
10
+ "lion":"์‚ฌ์ž",
11
+ "love":"์‚ฌ๋ž‘"
12
+ }
13
+ dict = {"ko2en":ko2enDict, "en2ko":en2koDict}
14
+ def trans(type, word, progress=gr.Progress()):
15
+ progress(0, desc="start!")
16
+ time.sleep(1)
17
+ progress(0.5, desc="half")
18
+ time.sleep(1)
19
+ progress(1, desc="done")
20
+ return dict[type][word]
21
+
22
+ app = gr.Interface(
23
+ fn=trans,
24
+ inputs=[gr.Radio(["ko2en", "en2ko"]), gr.Textbox(placeholder="๊ฒ€์ƒ‰์–ด")],
25
+ outputs="text",
26
+ examples=[["ko2en", "์‚ฌ์ž"]],
27
+ flag_allow="auto"
28
+ )
29
+
30
+ app.queue().launch()