File size: 552 Bytes
07a60fe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import gradio as gr

def is_palindrome(text):
    cleaned = ''.join(c.lower() for c in text if c.isalnum())
    return "βœ… Palindrome" if cleaned == cleaned[::-1] else "❌ Not a palindrome"

with gr.Blocks() as demo:
    gr.Markdown("## πŸ” Palindrome Checker")
    gr.Markdown("Enter text to check if it is a palindrome.")
    
    text_input = gr.Textbox(label="Input Text")
    result_output = gr.Label()
    
    check_button = gr.Button("Check")
    check_button.click(fn=is_palindrome, inputs=text_input, outputs=result_output)

demo.launch()