Spaces:
Sleeping
Sleeping
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() | |