shanzaejaz's picture
Create app.py
17978f3 verified
raw
history blame contribute delete
984 Bytes
import gradio as gr
def convert_text(text):
upper_text = text.upper()
lower_text = text.lower()
# Proper sentence case (after every dot)
sentences = text.split(".")
sentence_text = ". ".join(
s.strip().capitalize() for s in sentences if s.strip()
)
return upper_text, lower_text, sentence_text
with gr.Blocks(title="Text Case Converter") as demo:
gr.Markdown(
"""
# 🔤 Text Case Converter
Converts text into **UPPERCASE**, **lowercase**, and **Sentence case**.
"""
)
input_text = gr.Textbox(label="Enter Text", lines=4)
convert_btn = gr.Button("Convert")
upper_output = gr.Textbox(label="UPPERCASE Output")
lower_output = gr.Textbox(label="lowercase Output")
sentence_output = gr.Textbox(label="Sentence case Output")
convert_btn.click(
fn=convert_text,
inputs=input_text,
outputs=[upper_output, lower_output, sentence_output]
)
demo.launch()