wannaphong's picture
Create app.py
d0d81c3 verified
raw
history blame
957 Bytes
import gradio as gr
thai_consonants = "กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรลวศษสหฬอฮ" # 44 chars
thai_vowels = (
"\u0e24\u0e26\u0e30\u0e31\u0e32\u0e33\u0e34\u0e35\u0e36\u0e37"
+ "\u0e38\u0e39\u0e40\u0e41\u0e42\u0e43\u0e44\u0e45\u0e4d\u0e47"
) # 20
thai_lead_vowels = "\u0e40\u0e41\u0e42\u0e43\u0e44" # 5
thai_follow_vowels = "\u0e30\u0e32\u0e33\u0e45" # 4
thai_above_vowels = "\u0e31\u0e34\u0e35\u0e36\u0e37\u0e4d\u0e47" # 7
thai_below_vowels = "\u0e38\u0e39" # 2
thai_tonemarks = "\u0e48\u0e49\u0e4a\u0e4b" # 4
all_thai = list(thai_consonants + thai_vowels)
def greet(name):
_temp = []
for i in all_thai:
if i not in name:
_temp.append(i)
if len(_temp)>0:
return "Not complete: "+" ".join(_temp)
return "Complete!!! :D"
demo = gr.Interface(fn=greet, inputs="text", outputs="text",live=True)
demo.launch()