Commit
·
d0a3805
1
Parent(s):
72fb3d9
Update app.py
Browse files
app.py
CHANGED
@@ -13,33 +13,7 @@ from gradio.layouts import Column, Row
|
|
13 |
from gradio.data_classes import InterfaceTypes
|
14 |
import inspect
|
15 |
|
16 |
-
# CustomInterface class definition
|
17 |
-
class CustomInterface(gr.Interface):
|
18 |
-
def render_input_column(self):
|
19 |
-
submit_btn, clear_btn, stop_btn, flag_btns = None, None, None, None
|
20 |
|
21 |
-
with Column(variant="panel"):
|
22 |
-
input_component_column = Column()
|
23 |
-
with input_component_column:
|
24 |
-
for component in self.input_components:
|
25 |
-
component.render()
|
26 |
-
with Row():
|
27 |
-
if self.interface_type in [InterfaceTypes.STANDARD, InterfaceTypes.INPUT_ONLY]:
|
28 |
-
clear_btn = ClearButton(value = "Clear your search")
|
29 |
-
if not self.live:
|
30 |
-
submit_btn = Button("Submit your search", variant="primary") # Custom label
|
31 |
-
if inspect.isgeneratorfunction(self.fn) or inspect.isasyncgenfunction(self.fn):
|
32 |
-
stop_btn = Button("Stop", variant="stop", visible=False)
|
33 |
-
elif self.interface_type == InterfaceTypes.UNIFIED:
|
34 |
-
clear_btn = ClearButton(value = "Clear your search")
|
35 |
-
submit_btn = Button("Submit your search", variant="primary") # Custom label
|
36 |
-
if (inspect.isgeneratorfunction(self.fn) or inspect.isasyncgenfunction(self.fn)) and not self.live:
|
37 |
-
stop_btn = Button("Stop", variant="stop")
|
38 |
-
if self.allow_flagging == "manual":
|
39 |
-
flag_btns = self.render_flag_btns()
|
40 |
-
elif self.allow_flagging == "auto":
|
41 |
-
flag_btns = [submit_btn]
|
42 |
-
return submit_btn, clear_btn, stop_btn, flag_btns, input_component_column
|
43 |
|
44 |
# CustomInterface class definition
|
45 |
class CustomInterface(gr.Interface):
|
@@ -53,14 +27,14 @@ class CustomInterface(gr.Interface):
|
|
53 |
component.render()
|
54 |
with Row():
|
55 |
if self.interface_type in [InterfaceTypes.STANDARD, InterfaceTypes.INPUT_ONLY]:
|
56 |
-
clear_btn = ClearButton(value="
|
57 |
if not self.live:
|
58 |
-
submit_btn = Button("
|
59 |
if inspect.isgeneratorfunction(self.fn) or inspect.isasyncgenfunction(self.fn):
|
60 |
stop_btn = Button("Stop", variant="stop", visible=False)
|
61 |
elif self.interface_type == InterfaceTypes.UNIFIED:
|
62 |
-
clear_btn = ClearButton(value="
|
63 |
-
submit_btn = Button("
|
64 |
if (inspect.isgeneratorfunction(self.fn) or inspect.isasyncgenfunction(self.fn)) and not self.live:
|
65 |
stop_btn = Button("Stop", variant="stop")
|
66 |
if self.allow_flagging == "manual":
|
|
|
13 |
from gradio.data_classes import InterfaceTypes
|
14 |
import inspect
|
15 |
|
|
|
|
|
|
|
|
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
# CustomInterface class definition
|
19 |
class CustomInterface(gr.Interface):
|
|
|
27 |
component.render()
|
28 |
with Row():
|
29 |
if self.interface_type in [InterfaceTypes.STANDARD, InterfaceTypes.INPUT_ONLY]:
|
30 |
+
clear_btn = ClearButton(value="Clear your search ✅")
|
31 |
if not self.live:
|
32 |
+
submit_btn = Button("Submit your search", variant="primary") # Custom label
|
33 |
if inspect.isgeneratorfunction(self.fn) or inspect.isasyncgenfunction(self.fn):
|
34 |
stop_btn = Button("Stop", variant="stop", visible=False)
|
35 |
elif self.interface_type == InterfaceTypes.UNIFIED:
|
36 |
+
clear_btn = ClearButton(value="Clear your search ✅")
|
37 |
+
submit_btn = Button("Submit your search", variant="primary") # Custom label
|
38 |
if (inspect.isgeneratorfunction(self.fn) or inspect.isasyncgenfunction(self.fn)) and not self.live:
|
39 |
stop_btn = Button("Stop", variant="stop")
|
40 |
if self.allow_flagging == "manual":
|