Spaces:
Runtime error
Runtime error
Updated with flip text
Browse files
app.py
CHANGED
|
@@ -1,5 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
|
|
|
|
|
|
| 3 |
|
| 4 |
def greet(name, is_morning, temperature):
|
| 5 |
salutation = "Good morning" if is_morning else "Good evening"
|
|
@@ -12,5 +14,22 @@ iface = gr.Interface(
|
|
| 12 |
fn=greet,
|
| 13 |
inputs=["text", "checkbox", gr.Slider(0, 100)],
|
| 14 |
outputs=["text", "number"],
|
|
|
|
| 15 |
)
|
| 16 |
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
# Code to greet
|
| 4 |
+
|
| 5 |
|
| 6 |
def greet(name, is_morning, temperature):
|
| 7 |
salutation = "Good morning" if is_morning else "Good evening"
|
|
|
|
| 14 |
fn=greet,
|
| 15 |
inputs=["text", "checkbox", gr.Slider(0, 100)],
|
| 16 |
outputs=["text", "number"],
|
| 17 |
+
title="Greeting"
|
| 18 |
)
|
| 19 |
iface.launch()
|
| 20 |
+
|
| 21 |
+
# Code to flip a text
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def flip_text(x):
|
| 25 |
+
return x[::-1]
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
with gr.Blocks() as demo:
|
| 29 |
+
gr.Markdown("Flip text using this demo.")
|
| 30 |
+
with gr.Tab("Flip Text"):
|
| 31 |
+
text_input = gr.Textbox()
|
| 32 |
+
text_output = gr.Textbox()
|
| 33 |
+
text_button = gr.Button("Flip")
|
| 34 |
+
text_button.click(flip_text, inputs=text_input, outputs=text_output)
|
| 35 |
+
demo.launch()
|