Update ui
Browse files- components.py +10 -9
- examples/authenticate_google.py +3 -1
- examples/best_clubs.py +3 -1
- examples/generate_ad.py +4 -1
- examples/summarize_website.py +2 -1
components.py
CHANGED
@@ -122,16 +122,17 @@ class CodeTask(TaskComponent):
|
|
122 |
super().__init__(id_, value, visible)
|
123 |
self._initial_code_value = code_value
|
124 |
|
125 |
-
def _render(self) -> gr.
|
126 |
-
with gr.
|
127 |
-
self.code_prompt = gr.Textbox(
|
128 |
-
label="What would you like to do?",
|
129 |
-
interactive=True,
|
130 |
-
value=self._initial_code_value,
|
131 |
-
)
|
132 |
-
generate_code = gr.Button("Generate code")
|
133 |
with gr.Row():
|
134 |
with gr.Column():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
with gr.Accordion(label="Generated code", open=False) as accordion:
|
136 |
self.accordion = accordion
|
137 |
self.raw_output = gr.Textbox(
|
@@ -158,7 +159,7 @@ class CodeTask(TaskComponent):
|
|
158 |
with gr.Column():
|
159 |
self.output = gr.Textbox(
|
160 |
label=f"Output: {{{self.vname}{self._id}}}",
|
161 |
-
lines=
|
162 |
interactive=True,
|
163 |
)
|
164 |
|
|
|
122 |
super().__init__(id_, value, visible)
|
123 |
self._initial_code_value = code_value
|
124 |
|
125 |
+
def _render(self) -> gr.Box:
|
126 |
+
with gr.Box(visible=self._initial_visbility) as gr_component:
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
with gr.Row():
|
128 |
with gr.Column():
|
129 |
+
self.code_prompt = gr.Textbox(
|
130 |
+
label="What would you like to do?",
|
131 |
+
interactive=True,
|
132 |
+
value=self._initial_code_value,
|
133 |
+
lines=3,
|
134 |
+
)
|
135 |
+
generate_code = gr.Button("Generate code")
|
136 |
with gr.Accordion(label="Generated code", open=False) as accordion:
|
137 |
self.accordion = accordion
|
138 |
self.raw_output = gr.Textbox(
|
|
|
159 |
with gr.Column():
|
160 |
self.output = gr.Textbox(
|
161 |
label=f"Output: {{{self.vname}{self._id}}}",
|
162 |
+
lines=13,
|
163 |
interactive=True,
|
164 |
)
|
165 |
|
examples/authenticate_google.py
CHANGED
@@ -32,20 +32,22 @@ demo_tasks[DEMO_ID] = tasks
|
|
32 |
|
33 |
def render():
|
34 |
with gr.Tab("Example: Authenticate to google"):
|
|
|
35 |
with gr.Box():
|
36 |
-
demo_id = gr.Textbox(DEMO_ID, visible=False)
|
37 |
gr.Dropdown(
|
38 |
value=CodeTask.name,
|
39 |
label="Pick a new Task",
|
40 |
interactive=False,
|
41 |
)
|
42 |
tasks[0].render()
|
|
|
43 |
gr.Dropdown(
|
44 |
value=CodeTask.name,
|
45 |
label="Pick a new Task",
|
46 |
interactive=False,
|
47 |
)
|
48 |
tasks[1].render()
|
|
|
49 |
gr.Dropdown(
|
50 |
value=AITask.name,
|
51 |
label="Pick a new Task",
|
|
|
32 |
|
33 |
def render():
|
34 |
with gr.Tab("Example: Authenticate to google"):
|
35 |
+
demo_id = gr.Textbox(DEMO_ID, visible=False)
|
36 |
with gr.Box():
|
|
|
37 |
gr.Dropdown(
|
38 |
value=CodeTask.name,
|
39 |
label="Pick a new Task",
|
40 |
interactive=False,
|
41 |
)
|
42 |
tasks[0].render()
|
43 |
+
with gr.Box():
|
44 |
gr.Dropdown(
|
45 |
value=CodeTask.name,
|
46 |
label="Pick a new Task",
|
47 |
interactive=False,
|
48 |
)
|
49 |
tasks[1].render()
|
50 |
+
with gr.Box():
|
51 |
gr.Dropdown(
|
52 |
value=AITask.name,
|
53 |
label="Pick a new Task",
|
examples/best_clubs.py
CHANGED
@@ -33,20 +33,22 @@ demo_tasks[DEMO_ID] = tasks
|
|
33 |
|
34 |
def render():
|
35 |
with gr.Tab("Example: Nightlife in NYC"):
|
|
|
36 |
with gr.Box():
|
37 |
-
demo_id = gr.Textbox(DEMO_ID, visible=False)
|
38 |
gr.Dropdown(
|
39 |
value=CodeTask.name,
|
40 |
label="Pick a new Task",
|
41 |
interactive=False,
|
42 |
)
|
43 |
tasks[0].render()
|
|
|
44 |
gr.Dropdown(
|
45 |
value=CodeTask.name,
|
46 |
label="Pick a new Task",
|
47 |
interactive=False,
|
48 |
)
|
49 |
tasks[1].render()
|
|
|
50 |
gr.Dropdown(
|
51 |
value=AITask.name,
|
52 |
label="Pick a new Task",
|
|
|
33 |
|
34 |
def render():
|
35 |
with gr.Tab("Example: Nightlife in NYC"):
|
36 |
+
demo_id = gr.Textbox(DEMO_ID, visible=False)
|
37 |
with gr.Box():
|
|
|
38 |
gr.Dropdown(
|
39 |
value=CodeTask.name,
|
40 |
label="Pick a new Task",
|
41 |
interactive=False,
|
42 |
)
|
43 |
tasks[0].render()
|
44 |
+
with gr.Box():
|
45 |
gr.Dropdown(
|
46 |
value=CodeTask.name,
|
47 |
label="Pick a new Task",
|
48 |
interactive=False,
|
49 |
)
|
50 |
tasks[1].render()
|
51 |
+
with gr.Box():
|
52 |
gr.Dropdown(
|
53 |
value=AITask.name,
|
54 |
label="Pick a new Task",
|
examples/generate_ad.py
CHANGED
@@ -47,26 +47,29 @@ demo_tasks[DEMO_ID] = tasks
|
|
47 |
|
48 |
def render():
|
49 |
with gr.Tab("Example: Generate an ad"):
|
|
|
50 |
with gr.Box():
|
51 |
-
demo_id = gr.Textbox(DEMO_ID, visible=False)
|
52 |
gr.Dropdown(
|
53 |
value=CodeTask.name,
|
54 |
label="Pick a new Task",
|
55 |
interactive=False,
|
56 |
)
|
57 |
tasks[0].render()
|
|
|
58 |
gr.Dropdown(
|
59 |
value=AITask.name,
|
60 |
label="Pick a new Task",
|
61 |
interactive=False,
|
62 |
)
|
63 |
tasks[1].render()
|
|
|
64 |
gr.Dropdown(
|
65 |
value=CodeTask.name,
|
66 |
label="Pick a new Task",
|
67 |
interactive=False,
|
68 |
)
|
69 |
tasks[2].render()
|
|
|
70 |
gr.Dropdown(
|
71 |
value=AITask.name,
|
72 |
label="Pick a new Task",
|
|
|
47 |
|
48 |
def render():
|
49 |
with gr.Tab("Example: Generate an ad"):
|
50 |
+
demo_id = gr.Textbox(DEMO_ID, visible=False)
|
51 |
with gr.Box():
|
|
|
52 |
gr.Dropdown(
|
53 |
value=CodeTask.name,
|
54 |
label="Pick a new Task",
|
55 |
interactive=False,
|
56 |
)
|
57 |
tasks[0].render()
|
58 |
+
with gr.Box():
|
59 |
gr.Dropdown(
|
60 |
value=AITask.name,
|
61 |
label="Pick a new Task",
|
62 |
interactive=False,
|
63 |
)
|
64 |
tasks[1].render()
|
65 |
+
with gr.Box():
|
66 |
gr.Dropdown(
|
67 |
value=CodeTask.name,
|
68 |
label="Pick a new Task",
|
69 |
interactive=False,
|
70 |
)
|
71 |
tasks[2].render()
|
72 |
+
with gr.Box():
|
73 |
gr.Dropdown(
|
74 |
value=AITask.name,
|
75 |
label="Pick a new Task",
|
examples/summarize_website.py
CHANGED
@@ -19,14 +19,15 @@ demo_tasks[DEMO_ID] = tasks
|
|
19 |
|
20 |
def render():
|
21 |
with gr.Tab("Example: Summarize a website"):
|
|
|
22 |
with gr.Box():
|
23 |
-
demo_id = gr.Textbox(DEMO_ID, visible=False)
|
24 |
gr.Dropdown(
|
25 |
value=CodeTask.name,
|
26 |
label="Pick a new Task",
|
27 |
interactive=False,
|
28 |
)
|
29 |
tasks[0].render()
|
|
|
30 |
gr.Dropdown(
|
31 |
value=AITask.name,
|
32 |
label="Pick a new Task",
|
|
|
19 |
|
20 |
def render():
|
21 |
with gr.Tab("Example: Summarize a website"):
|
22 |
+
demo_id = gr.Textbox(DEMO_ID, visible=False)
|
23 |
with gr.Box():
|
|
|
24 |
gr.Dropdown(
|
25 |
value=CodeTask.name,
|
26 |
label="Pick a new Task",
|
27 |
interactive=False,
|
28 |
)
|
29 |
tasks[0].render()
|
30 |
+
with gr.Box():
|
31 |
gr.Dropdown(
|
32 |
value=AITask.name,
|
33 |
label="Pick a new Task",
|