MaheshP98's picture
Create app.py
07a60fe verified
raw
history blame contribute delete
552 Bytes
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()