|
from abc import ABC |
|
|
|
import gradio as gr |
|
|
|
|
|
class CustomBlocks(gr.Blocks): |
|
def __init__(self, *args, **kwargs): |
|
super().__init__(*args, **kwargs) |
|
|
|
|
|
def custom_action(self): |
|
|
|
print("Custom button clicked!") |
|
|
|
|
|
|
|
class CustomButton(gr.Button): |
|
def __init__(self, *args, **kwargs): |
|
super().__init__(*args, **kwargs) |
|
|
|
|
|
def custom_action(self): |
|
|
|
print("Custom button clicked!") |
|
|
|
|
|
import gradio as gr |
|
|
|
def image_classifier(inp): |
|
return {'cat': 0.3, 'dog': 0.7} |
|
|
|
with CustomBlocks() as demo: |
|
custom_button = CustomButton("Custom Button") |
|
|
|
|
|
demo.launch() |
|
|