wannaphong commited on
Commit
d0d81c3
·
verified ·
1 Parent(s): 3278ef9

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -0
app.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ thai_consonants = "กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรลวศษสหฬอฮ" # 44 chars
4
+
5
+ thai_vowels = (
6
+ "\u0e24\u0e26\u0e30\u0e31\u0e32\u0e33\u0e34\u0e35\u0e36\u0e37"
7
+ + "\u0e38\u0e39\u0e40\u0e41\u0e42\u0e43\u0e44\u0e45\u0e4d\u0e47"
8
+ ) # 20
9
+ thai_lead_vowels = "\u0e40\u0e41\u0e42\u0e43\u0e44" # 5
10
+ thai_follow_vowels = "\u0e30\u0e32\u0e33\u0e45" # 4
11
+ thai_above_vowels = "\u0e31\u0e34\u0e35\u0e36\u0e37\u0e4d\u0e47" # 7
12
+ thai_below_vowels = "\u0e38\u0e39" # 2
13
+
14
+ thai_tonemarks = "\u0e48\u0e49\u0e4a\u0e4b" # 4
15
+
16
+ all_thai = list(thai_consonants + thai_vowels)
17
+
18
+ def greet(name):
19
+ _temp = []
20
+ for i in all_thai:
21
+ if i not in name:
22
+ _temp.append(i)
23
+ if len(_temp)>0:
24
+ return "Not complete: "+" ".join(_temp)
25
+ return "Complete!!! :D"
26
+
27
+ demo = gr.Interface(fn=greet, inputs="text", outputs="text",live=True)
28
+ demo.launch()