Spaces:
Sleeping
Sleeping
File size: 984 Bytes
17978f3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | 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()
|