| import gradio as gr |
|
|
| lopek = ["i love you", "ilopyu", "i <3 u", "ai lof yu", "lop yu"] |
| sangean = ["ah", "ahh"] |
| gajelas = ["`", "~", "!", "@", "#", "$", "%", "^", "&", "*", "(", "0", "-", "_", "=", "+", "[", "{", "]", "}", ";", ':', "'", ",", "<", ".", ">", "/", "?"] |
|
|
| def analyze_text(text): |
| |
| text = text.lower() |
|
|
| if text: |
| if text == "": |
| result = "MASUKKIN THE TEXT IDIOT" |
| elif text.startswith(tuple(lopek)) or text.endswith(tuple(lopek)): |
| result = "Love you too...." |
| elif text.startswith(tuple(sangean)) or text.endswith(tuple(sangean)): |
| result = "You is sangean" |
| elif text.startswith(tuple(gajelas)) or text.endswith(tuple(gajelas)): |
| result = "GAJELAS IDIOT" |
| else: |
| result = f"You memasukkan text: {text}" |
| return result |
| else: |
| result = "ERROR ANJING!" |
| return result |
|
|
| iface = gr.Interface( |
| fn=analyze_text, |
| inputs=gr.Textbox(label="Input", placeholder="Enter Text Here", show_copy_button=True), |
| outputs=gr.Textbox(type="text", label="Output", show_copy_button=True) |
| ) |
|
|
| iface.launch(show_api=False) |
|
|