Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,41 +1,41 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
from gradio_textboxplus import TextboxPlus # Make sure this import is correct
|
3 |
-
|
4 |
-
# --- 1. Define a simple function for the demo ---
|
5 |
-
|
6 |
-
def process_text(input_text):
|
7 |
-
"""
|
8 |
-
A simple function that takes text and returns it,
|
9 |
-
demonstrating the component's input/output capabilities.
|
10 |
-
"""
|
11 |
-
if not input_text:
|
12 |
-
return "You didn't enter anything!"
|
13 |
-
return f"You entered: '{input_text}'"
|
14 |
-
|
15 |
-
# --- 2. Build the Gradio App using Blocks ---
|
16 |
-
|
17 |
-
with gr.Blocks(theme=gr.themes.Ocean(), title="TextboxPlus Demo") as demo:
|
18 |
-
gr.Markdown(
|
19 |
-
"""
|
20 |
-
# TextboxPlus Component Demo
|
21 |
-
This is a simple demonstration of the `TextboxPlus` custom component,
|
22 |
-
highlighting the new `help` tooltip feature.
|
23 |
-
"""
|
24 |
-
)
|
25 |
-
|
26 |
-
# --- Interactive Textbox with Help Tooltip ---
|
27 |
-
# This is the main component being demonstrated.
|
28 |
-
input_box = TextboxPlus(
|
29 |
-
label="Your Name",
|
30 |
-
info="Please enter your full name.",
|
31 |
-
# The key feature: the help text for the tooltip.
|
32 |
-
help="Hover over the
|
33 |
-
placeholder="e.g., Jane Doe",
|
34 |
-
interactive=True,
|
35 |
-
elem_id="textboxplus-input",
|
36 |
-
)
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
if __name__ == "__main__":
|
41 |
demo.launch()
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from gradio_textboxplus import TextboxPlus # Make sure this import is correct
|
3 |
+
|
4 |
+
# --- 1. Define a simple function for the demo ---
|
5 |
+
|
6 |
+
def process_text(input_text):
|
7 |
+
"""
|
8 |
+
A simple function that takes text and returns it,
|
9 |
+
demonstrating the component's input/output capabilities.
|
10 |
+
"""
|
11 |
+
if not input_text:
|
12 |
+
return "You didn't enter anything!"
|
13 |
+
return f"You entered: '{input_text}'"
|
14 |
+
|
15 |
+
# --- 2. Build the Gradio App using Blocks ---
|
16 |
+
|
17 |
+
with gr.Blocks(theme=gr.themes.Ocean(), title="TextboxPlus Demo") as demo:
|
18 |
+
gr.Markdown(
|
19 |
+
"""
|
20 |
+
# TextboxPlus Component Demo
|
21 |
+
This is a simple demonstration of the `TextboxPlus` custom component,
|
22 |
+
highlighting the new `help` tooltip feature.
|
23 |
+
"""
|
24 |
+
)
|
25 |
+
|
26 |
+
# --- Interactive Textbox with Help Tooltip ---
|
27 |
+
# This is the main component being demonstrated.
|
28 |
+
input_box = TextboxPlus(
|
29 |
+
label="Your Name",
|
30 |
+
info="Please enter your full name.",
|
31 |
+
# The key feature: the help text for the tooltip.
|
32 |
+
help="Hover over the (?) icon to see this help message, This provides brief, contextual guidance for the user.",
|
33 |
+
placeholder="e.g., Jane Doe",
|
34 |
+
interactive=True,
|
35 |
+
elem_id="textboxplus-input",
|
36 |
+
)
|
37 |
+
|
38 |
+
|
39 |
+
|
40 |
+
if __name__ == "__main__":
|
41 |
demo.launch()
|