Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
def convert_text(text):
|
| 4 |
+
"""
|
| 5 |
+
Converts input text to uppercase and lowercase.
|
| 6 |
+
"""
|
| 7 |
+
if not text:
|
| 8 |
+
return "", ""
|
| 9 |
+
return text.upper(), text.lower()
|
| 10 |
+
|
| 11 |
+
with gr.Blocks(title="Text Case Converter") as app:
|
| 12 |
+
gr.Markdown("# Text Case Converter")
|
| 13 |
+
gr.Markdown("Enter text below to see it converted into uppercase and lowercase.")
|
| 14 |
+
|
| 15 |
+
text_input = gr.Textbox(
|
| 16 |
+
label="Enter Text",
|
| 17 |
+
placeholder="Type something here...",
|
| 18 |
+
lines=4
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
uppercase_output = gr.Textbox(
|
| 22 |
+
label="UPPERCASE Output",
|
| 23 |
+
lines=4
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
lowercase_output = gr.Textbox(
|
| 27 |
+
label="lowercase output",
|
| 28 |
+
lines=4
|
| 29 |
+
)
|
| 30 |
+
|
| 31 |
+
convert_button = gr.Button("Convert")
|
| 32 |
+
|
| 33 |
+
convert_button.click(
|
| 34 |
+
fn=convert_text,
|
| 35 |
+
inputs=text_input,
|
| 36 |
+
outputs=[uppercase_output, lowercase_output]
|
| 37 |
+
)
|
| 38 |
+
|
| 39 |
+
app.launch()
|