dwipper commited on
Commit
0e10161
1 Parent(s): cc5194d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +71 -11
app.py CHANGED
@@ -2,31 +2,91 @@
2
  import gradio as gr
3
  from gradio_buttontip import ButtonTip
4
 
5
- def button_click():
6
- return "Button clicked!"
7
 
8
- with gr.Blocks() as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  gr.Markdown("This interface showcases a button with a tooltip.")
10
  with gr.Row():
11
- inp = [
12
- ButtonTip(
13
  tooltip="Tooltip Text",
14
  tooltip_color="white", # Custom color
15
  tooltip_background_color="red",
16
  x=120, # No horizontal offset
17
  y=-20, # Above the button
18
- value="Left Button"
19
- ),
20
- ButtonTip(
 
 
 
 
21
  tooltip="Tooltip Text",
22
  tooltip_color="white", # Custom color
23
  tooltip_background_color="blue",
24
  x=-90, # No horizontal offset
25
  y=-20, # Above the button
26
- value="Right Button"
 
 
 
 
27
  )
28
- ]
29
- out = "Hello World"
 
 
 
 
 
 
 
 
 
 
 
 
 
30
 
31
  if __name__ == "__main__":
32
  demo.launch()
 
2
  import gradio as gr
3
  from gradio_buttontip import ButtonTip
4
 
5
+ def submit():
6
+ return gr.Button(value='New Left Button'), gr.Button(value='New Right Button')
7
 
8
+
9
+ css = """
10
+ .icon-button {
11
+ display: flex;
12
+ background-color: transparent;
13
+ border: none;
14
+ box-shadow: none;
15
+ padding: 0px 0px;
16
+ justify-content: center;
17
+ align-items: center;
18
+ max-height: 24px;
19
+ min-height: 24px;
20
+ max-width: 24px !important;
21
+ min-width: 24px !important;
22
+ }
23
+ """
24
+
25
+ CIMStheme = gr.themes.Soft().set(
26
+ button_primary_background_fill='#000D65',
27
+ button_primary_border_color='#000D65',
28
+ button_secondary_background_fill='#FFFFFF',
29
+ button_primary_background_fill_hover='#454E8E',
30
+ block_title_text_color='#000D65',
31
+ block_title_background_fill='#E6E7F0',
32
+ block_label_background_fill='#E6E7F0',
33
+ block_label_text_color='#000D65',
34
+ button_secondary_border_color='#000D65',
35
+ button_secondary_text_color='#000D65',
36
+ button_border_width='2px',
37
+ checkbox_label_background_fill='#F9FAFB',
38
+ checkbox_label_background_fill_selected='#E6E7F0',
39
+ checkbox_background_color_selected='#000D65',
40
+ checkbox_border_color_selected='#000D65',
41
+ checkbox_border_color='#E5E7EB',
42
+ checkbox_background_color='#F9FAFB',
43
+ checkbox_label_border_color='#ababab',
44
+ checkbox_label_text_color='#000D65',
45
+ checkbox_label_text_color_selected='#000D65'
46
+ )
47
+
48
+ with gr.Blocks(css=css, theme=CIMStheme) as demo:
49
  gr.Markdown("This interface showcases a button with a tooltip.")
50
  with gr.Row():
51
+ first_btn = ButtonTip(
 
52
  tooltip="Tooltip Text",
53
  tooltip_color="white", # Custom color
54
  tooltip_background_color="red",
55
  x=120, # No horizontal offset
56
  y=-20, # Above the button
57
+ value="",
58
+ elem_classes=['icon-button'],
59
+ variant='primary',
60
+ icon='QuizIcon.png',
61
+ scale=0
62
+ )
63
+ second_btn = ButtonTip(
64
  tooltip="Tooltip Text",
65
  tooltip_color="white", # Custom color
66
  tooltip_background_color="blue",
67
  x=-90, # No horizontal offset
68
  y=-20, # Above the button
69
+ value="",
70
+ elem_classes=['icon-button'],
71
+ variant='primary',
72
+ icon='PDFIcon.png',
73
+ scale=0
74
  )
75
+ with gr.Row():
76
+ third_btn = gr.Button(value="",
77
+ elem_classes=['icon-button'],
78
+ variant='primary',
79
+ icon='QuizIcon.png',
80
+ scale=0)
81
+ fourth_btn = gr.Button( value="",
82
+ elem_classes=['icon-button'],
83
+ variant='primary',
84
+ icon='PDFIcon.png',
85
+ scale=0)
86
+ with gr.Row():
87
+ submit_btn = gr.Button(value='Submit')
88
+ submit_btn.click(fn=submit, inputs=None, outputs=[first_btn, second_btn])
89
+ #submit_btn.click(fn=submit, inputs=None, outputs=[third_btn, fourth_btn])
90
 
91
  if __name__ == "__main__":
92
  demo.launch()