|
|
| import gradio as gr |
| from gradio_buttontip import ButtonTip |
|
|
| def button_click(): |
| return "Button clicked!" |
|
|
| demo = gr.Interface( |
| title="Button with Tooltip", |
| description="This interface showcases a button with a tooltip.", |
| fn=button_click, |
| inputs=[ |
| ButtonTip( |
| tooltip="Tooltip Text", |
| tooltip_color="white", |
| tooltip_background_color="red", |
| x=120, |
| y=-20, |
| value="Top Button" |
| ), |
| ButtonTip( |
| tooltip="Tooltip Text", |
| tooltip_color="white", |
| tooltip_background_color="green", |
| x=140, |
| y=20, |
| value="Bottom Button" |
| ) |
| ], |
| outputs="text", |
| ) |
|
|
|
|
| if __name__ == "__main__": |
| demo.launch() |
|
|