Add application file
Browse files- app.py +35 -0
- requirements.txt +1 -0
app.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import gradio as gr
|
| 3 |
+
from gradio_buttontip import ButtonTip
|
| 4 |
+
|
| 5 |
+
def button_click():
|
| 6 |
+
return "Button clicked!"
|
| 7 |
+
|
| 8 |
+
demo = gr.Interface(
|
| 9 |
+
title="Button with Tooltip",
|
| 10 |
+
description="This interface showcases a button with a tooltip.",
|
| 11 |
+
fn=button_click,
|
| 12 |
+
inputs=[
|
| 13 |
+
ButtonTip(
|
| 14 |
+
tooltip="Tooltip Text",
|
| 15 |
+
tooltip_color="white", # Custom color
|
| 16 |
+
tooltip_background_color="red",
|
| 17 |
+
x=120, # No horizontal offset
|
| 18 |
+
y=-20, # Above the button
|
| 19 |
+
value="Top Button"
|
| 20 |
+
),
|
| 21 |
+
ButtonTip(
|
| 22 |
+
tooltip="Tooltip Text",
|
| 23 |
+
tooltip_color="white", # Custom color
|
| 24 |
+
tooltip_background_color="green",
|
| 25 |
+
x=140, # No horizontal offset
|
| 26 |
+
y=20, # Below the button
|
| 27 |
+
value="Bottom Button"
|
| 28 |
+
)
|
| 29 |
+
],
|
| 30 |
+
outputs="text",
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
if __name__ == "__main__":
|
| 35 |
+
demo.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
gradio_buttontip
|