yizhangliu
commited on
Commit
·
465b5fb
1
Parent(s):
b0cddf8
add FullStackBench Examples
Browse files
README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
---
|
2 |
-
title: Qwen2.5 Coder Artifacts
|
3 |
emoji: 🐢
|
4 |
colorFrom: gray
|
5 |
colorTo: red
|
|
|
1 |
---
|
2 |
+
title: Qwen2.5 Coder Artifacts (+SambaNova+FullStackBench)
|
3 |
emoji: 🐢
|
4 |
colorFrom: gray
|
5 |
colorTo: red
|
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import os
|
2 |
import re
|
3 |
import base64
|
|
|
4 |
from typing import Dict, List, Optional, Tuple
|
5 |
|
6 |
import gradio as gr
|
@@ -55,12 +56,166 @@ def demo_card_click(e: gr.EventData):
|
|
55 |
index = e._data['component']['index']
|
56 |
return DEMO_LIST[index]['description']
|
57 |
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
history_state = gr.State([])
|
60 |
setting = gr.State({
|
61 |
"system": SystemPrompt,
|
62 |
})
|
63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
with ms.Application() as app:
|
65 |
with antd.ConfigProvider():
|
66 |
with antd.Row(gutter=[32, 12]) as layout:
|
@@ -78,25 +233,17 @@ with gr.Blocks(css_paths="app.css") as demo:
|
|
78 |
</div>
|
79 |
""")
|
80 |
|
81 |
-
input = antd.InputTextarea(
|
82 |
-
|
83 |
-
btn = antd.Button("send", type="primary", size="large")
|
84 |
-
clear_btn = antd.Button("clear history", type="default", size="large")
|
85 |
-
|
86 |
-
antd.Divider("examples")
|
87 |
-
with antd.Flex(gap="small", wrap=True):
|
88 |
-
with ms.Each(DEMO_LIST):
|
89 |
-
with antd.Card(hoverable=True, as_item="card") as demoCard:
|
90 |
-
antd.CardMeta()
|
91 |
-
demoCard.click(demo_card_click, outputs=[input])
|
92 |
-
|
93 |
-
antd.Divider("setting")
|
94 |
|
95 |
with antd.Flex(gap="small", wrap=True):
|
96 |
settingPromptBtn = antd.Button(
|
97 |
"⚙️ set system Prompt", type="default")
|
98 |
codeBtn = antd.Button("🧑💻 view code", type="default")
|
99 |
historyBtn = antd.Button("📜 history", type="default")
|
|
|
|
|
100 |
|
101 |
with antd.Modal(open=False, title="set system Prompt", width="800px") as system_prompt_modal:
|
102 |
systemPromptInput = antd.InputTextarea(
|
@@ -124,18 +271,30 @@ with gr.Blocks(css_paths="app.css") as demo:
|
|
124 |
history_drawer.close(lambda: gr.update(
|
125 |
open=False), inputs=[], outputs=[history_drawer])
|
126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
with antd.Col(span=24, md=16):
|
128 |
with ms.Div(elem_classes="right_panel"):
|
129 |
gr.HTML('<div class="render_header"><span class="header_btn"></span><span class="header_btn"></span><span class="header_btn"></span></div>')
|
130 |
with antd.Tabs(active_key="empty", render_tab_bar="() => null") as state_tab:
|
131 |
-
with antd.Tabs.Item(key="empty"):
|
132 |
empty = antd.Empty(description="empty input", elem_classes="right_content")
|
133 |
-
with antd.Tabs.Item(key="loading"):
|
134 |
loading = antd.Spin(True, tip="coding...", size="large", elem_classes="right_content")
|
135 |
-
with antd.Tabs.Item(key="
|
136 |
sandbox = gr.HTML(elem_classes="html_content")
|
|
|
|
|
137 |
|
138 |
-
def generation_code(query: Optional[str], _setting: Dict[str, str], _history: Optional[History]):
|
139 |
if query is None:
|
140 |
query = ''
|
141 |
if _history is None:
|
@@ -143,7 +302,10 @@ with gr.Blocks(css_paths="app.css") as demo:
|
|
143 |
|
144 |
# Prepare the preprocess and postprocess functions
|
145 |
def preprocess(message, history):
|
146 |
-
|
|
|
|
|
|
|
147 |
for user_msg, assistant_msg in history:
|
148 |
messages.append({'role': 'user', 'content': user_msg})
|
149 |
messages.append({'role': 'assistant', 'content': assistant_msg})
|
@@ -179,20 +341,65 @@ with gr.Blocks(css_paths="app.css") as demo:
|
|
179 |
|
180 |
code = remove_code_block(assistant_response)
|
181 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
yield {
|
183 |
code_output: assistant_response,
|
184 |
history_state: local_history,
|
185 |
-
sandbox:
|
186 |
-
state_tab:
|
187 |
-
code_drawer:
|
|
|
|
|
|
|
188 |
}
|
189 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
btn.click(generation_code,
|
191 |
-
inputs=[input, setting, history_state],
|
192 |
-
outputs=[code_output, history_state, sandbox, state_tab, code_drawer
|
|
|
193 |
|
194 |
clear_btn.click(clear_history, inputs=[], outputs=[history_state])
|
195 |
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
if __name__ == "__main__":
|
197 |
-
demo.queue(default_concurrency_limit=20).launch(ssr_mode=False)
|
198 |
|
|
|
1 |
import os
|
2 |
import re
|
3 |
import base64
|
4 |
+
import json
|
5 |
from typing import Dict, List, Optional, Tuple
|
6 |
|
7 |
import gradio as gr
|
|
|
56 |
index = e._data['component']['index']
|
57 |
return DEMO_LIST[index]['description']
|
58 |
|
59 |
+
|
60 |
+
def read_jsonl(fn):
|
61 |
+
with open(fn, encoding="utf-8") as f:
|
62 |
+
return [json.loads(l) for l in f.readlines()]
|
63 |
+
|
64 |
+
def get_item_by_index(item_list, index, val=None):
|
65 |
+
if val is not None and val in item_list:
|
66 |
+
return val
|
67 |
+
if len(item_list) > index:
|
68 |
+
return item_list[index]
|
69 |
+
return ""
|
70 |
+
|
71 |
+
def get_item_list(locale="zh", programming_language="", category="", difficulty="", debugInfo=""):
|
72 |
+
samples = read_jsonl(f'./FullStackBench_data/fsb_{locale}_20241204.jsonl')
|
73 |
+
item_list_count = {}
|
74 |
+
item_samples = []
|
75 |
+
for sample in samples:
|
76 |
+
labels = sample['labels']
|
77 |
+
content = [sample['content']]
|
78 |
+
title = f"{labels['programming_language']}/{labels['category']}/{labels['difficulty']}"
|
79 |
+
sample_dict = [title, content, labels['programming_language']=='html']
|
80 |
+
if (locale != "" and labels['locale'] == locale):
|
81 |
+
if programming_language == "":
|
82 |
+
item = labels['programming_language']
|
83 |
+
item_list_count[item] = item_list_count.get(item, 0) + 1
|
84 |
+
item_samples.append(sample_dict)
|
85 |
+
elif category == "" and labels['programming_language'] == programming_language:
|
86 |
+
item = labels['category']
|
87 |
+
item_list_count[item] = item_list_count.get(item, 0) + 1
|
88 |
+
item_samples.append(sample_dict)
|
89 |
+
elif difficulty == "" and labels['programming_language'] == programming_language and labels['category'] == category:
|
90 |
+
item = labels['difficulty']
|
91 |
+
item_list_count[item] = item_list_count.get(item, 0) + 1
|
92 |
+
item_samples.append(sample_dict)
|
93 |
+
elif labels['programming_language'] == programming_language and labels['category'] == category and labels['difficulty'] == difficulty:
|
94 |
+
item = labels['difficulty']
|
95 |
+
item_list_count[item] = item_list_count.get(item, 0) + 1
|
96 |
+
item_samples.append(sample_dict)
|
97 |
+
item_list = list(item_list_count.keys())
|
98 |
+
item_list_dropdown = []
|
99 |
+
all_count = 0
|
100 |
+
for item in item_list:
|
101 |
+
all_count += item_list_count[item]
|
102 |
+
item_list_dropdown.append((f"{item}[{item_list_count[item]}]",item))
|
103 |
+
item_list_dropdown.insert(0,(f"All[{all_count}]", ""))
|
104 |
+
return item_list, item_list_dropdown, item_samples
|
105 |
+
|
106 |
+
item_list_locale = ["en", "zh"]
|
107 |
+
item_list_dropdown_locale = [("en[1687]", "en"), ("zh[1687]", "zh")]
|
108 |
+
item_list_programming_language, item_list_dropdown_programming_language, item_samples = get_item_list(locale=item_list_locale[0], programming_language="", category="", difficulty="")
|
109 |
+
item_list_category, item_list_dropdown_category, item_samples = get_item_list(locale=item_list_locale[0], programming_language=get_item_by_index(item_list_programming_language, 0, "python"), category="", difficulty="")
|
110 |
+
item_list_difficulty, item_list_dropdown_difficulty, item_samples = get_item_list(locale=item_list_locale[0], programming_language=get_item_by_index(item_list_programming_language, 0, "python"), category=get_item_by_index(item_list_category, 0, "Basic Programming"), difficulty="")
|
111 |
+
item_list_select, item_list_select_dropdown, item_samples = get_item_list(locale=item_list_locale[0], programming_language=get_item_by_index(item_list_programming_language, 0, "python"), category=get_item_by_index(item_list_category, 0, "Basic Programming"), difficulty=get_item_by_index(item_list_difficulty, 0))
|
112 |
+
|
113 |
+
def get_input_examples():
|
114 |
+
input_examples = []
|
115 |
+
for demo in DEMO_LIST:
|
116 |
+
input_examples.append([demo['title'], demo['description'], True])
|
117 |
+
return input_examples
|
118 |
+
|
119 |
+
with gr.Blocks(css_paths="app.css", title="Qwen2.5 Coder Artifacts (+SambaNova+FullStackBench)") as demo:
|
120 |
history_state = gr.State([])
|
121 |
setting = gr.State({
|
122 |
"system": SystemPrompt,
|
123 |
})
|
124 |
|
125 |
+
with gr.Row():
|
126 |
+
use_system_prompt_example = gr.Checkbox(show_label=False, value=True, visible=False)
|
127 |
+
input_text_title= gr.TextArea(show_label=False, container=False, visible=False)
|
128 |
+
input_text_example = gr.TextArea(show_label=False, container=False, visible=False)
|
129 |
+
with gr.Tab("Examples_HTML"):
|
130 |
+
input_examples = get_input_examples()
|
131 |
+
gr.Examples(
|
132 |
+
examples=input_examples,
|
133 |
+
inputs=[input_text_title, input_text_example, use_system_prompt_example],
|
134 |
+
outputs=None,
|
135 |
+
label='',
|
136 |
+
examples_per_page=10,
|
137 |
+
cache_examples=False,
|
138 |
+
)
|
139 |
+
with gr.Tab("Examples_from_FullStackBench"):
|
140 |
+
with gr.Row():
|
141 |
+
with gr.Column():
|
142 |
+
locale = gr.Dropdown(
|
143 |
+
choices=item_list_dropdown_locale,
|
144 |
+
label="locale",
|
145 |
+
value=get_item_by_index(item_list_locale, 0),
|
146 |
+
)
|
147 |
+
with gr.Column():
|
148 |
+
programming_language = gr.Dropdown(
|
149 |
+
choices=item_list_dropdown_programming_language,
|
150 |
+
label="programming_language",
|
151 |
+
value=get_item_by_index(item_list_programming_language, 0, "python"),
|
152 |
+
)
|
153 |
+
with gr.Column():
|
154 |
+
category = gr.Dropdown(
|
155 |
+
choices=item_list_dropdown_category,
|
156 |
+
label="category",
|
157 |
+
value=get_item_by_index(item_list_category, 0, "Basic Programming"),
|
158 |
+
)
|
159 |
+
with gr.Column():
|
160 |
+
difficulty = gr.Dropdown(
|
161 |
+
choices=item_list_dropdown_difficulty,
|
162 |
+
label="difficulty",
|
163 |
+
value=get_item_by_index(item_list_difficulty, 0),
|
164 |
+
)
|
165 |
+
with gr.Row():
|
166 |
+
test_examples = gr.Examples(
|
167 |
+
examples=item_samples,
|
168 |
+
inputs=[input_text_title, input_text_example, use_system_prompt_example],
|
169 |
+
outputs=None,
|
170 |
+
label='Examples:',
|
171 |
+
examples_per_page=5,
|
172 |
+
cache_examples=False,
|
173 |
+
)
|
174 |
+
def locale_select(locale):
|
175 |
+
item_list_programming_language, item_list_dropdown_programming_language, item_samples = get_item_list(locale=locale, programming_language="", category="", difficulty="", debugInfo="locale_1_")
|
176 |
+
item_list_category, item_list_dropdown_category, item_samples = get_item_list(locale=locale, programming_language=get_item_by_index(item_list_programming_language, 0), category="", difficulty="", debugInfo="locale_2_")
|
177 |
+
item_list_difficulty, item_list_dropdown_difficulty, item_samples = get_item_list(locale=locale, programming_language=get_item_by_index(item_list_programming_language, 0), category=get_item_by_index(item_list_category, 0), difficulty="", debugInfo="locale_3_")
|
178 |
+
_, _, item_samples = get_item_list(locale=locale, programming_language=get_item_by_index(item_list_programming_language, 0), category=get_item_by_index(item_list_category, 0), difficulty=get_item_by_index(item_list_difficulty, 0), debugInfo="locale_4_")
|
179 |
+
return (gr.Dropdown(choices=item_list_dropdown_programming_language, value=item_list_dropdown_programming_language[0][1]),
|
180 |
+
gr.Dropdown(choices=item_list_dropdown_category, value=item_list_dropdown_category[0][1]),
|
181 |
+
gr.Dropdown(choices=item_list_dropdown_difficulty, value=item_list_dropdown_difficulty[0][1]),
|
182 |
+
gr.Dataset(samples=item_samples))
|
183 |
+
locale.select(
|
184 |
+
fn=locale_select,
|
185 |
+
inputs=[locale],
|
186 |
+
outputs=[programming_language, category, difficulty, test_examples.dataset]
|
187 |
+
)
|
188 |
+
def programming_language_select(locale, programming_language):
|
189 |
+
item_list_category, item_list_dropdown_category, item_samples = get_item_list(locale=locale, programming_language=programming_language, category="", difficulty="", debugInfo="programming_language_1_")
|
190 |
+
item_list_difficulty, item_list_dropdown_difficulty, item_samples = get_item_list(locale=locale, programming_language=programming_language, category=get_item_by_index(item_list_category, 0), difficulty="", debugInfo="programming_language_2_")
|
191 |
+
_, _, item_samples = get_item_list(locale=locale, programming_language=programming_language, category=get_item_by_index(item_list_category, 0), difficulty=get_item_by_index(item_list_difficulty, 0), debugInfo="programming_language_3_")
|
192 |
+
return (gr.Dropdown(choices=item_list_dropdown_category, value=item_list_dropdown_category[0][1]),
|
193 |
+
gr.Dropdown(choices=item_list_dropdown_difficulty, value=item_list_dropdown_difficulty[0][1]),
|
194 |
+
gr.Dataset(samples=item_samples))
|
195 |
+
programming_language.select(
|
196 |
+
fn=programming_language_select,
|
197 |
+
inputs=[locale, programming_language],
|
198 |
+
outputs=[category, difficulty, test_examples.dataset]
|
199 |
+
)
|
200 |
+
def category_select(locale, programming_language, category):
|
201 |
+
item_list_difficulty, item_list_dropdown_difficulty, item_samples = get_item_list(locale=locale, programming_language=programming_language, category=category, difficulty="", debugInfo="category_1_")
|
202 |
+
_, _, item_samples = get_item_list(locale=locale, programming_language=programming_language, category=category, difficulty=get_item_by_index(item_list_difficulty, 0), debugInfo="category_2_")
|
203 |
+
return (gr.Dropdown(choices=item_list_dropdown_difficulty, value=item_list_dropdown_difficulty[0][1]),
|
204 |
+
gr.Dataset(samples=item_samples))
|
205 |
+
category.select(
|
206 |
+
fn=category_select,
|
207 |
+
inputs=[locale, programming_language, category],
|
208 |
+
outputs=[difficulty, test_examples.dataset]
|
209 |
+
)
|
210 |
+
def difficulty_select(locale, programming_language, category, difficulty):
|
211 |
+
_, _, item_samples = get_item_list(locale=locale, programming_language=programming_language, category=category, difficulty=difficulty, debugInfo="difficulty_1_")
|
212 |
+
return gr.Dataset(samples=item_samples)
|
213 |
+
difficulty.select(
|
214 |
+
fn=difficulty_select,
|
215 |
+
inputs=[locale, programming_language, category, difficulty],
|
216 |
+
outputs=[test_examples.dataset]
|
217 |
+
)
|
218 |
+
|
219 |
with ms.Application() as app:
|
220 |
with antd.ConfigProvider():
|
221 |
with antd.Row(gutter=[32, 12]) as layout:
|
|
|
233 |
</div>
|
234 |
""")
|
235 |
|
236 |
+
input = antd.InputTextarea(size="middle", allow_clear=True, placeholder="Please enter what kind of application you want")
|
237 |
+
use_system_prompt = gr.Checkbox(value=True, label="use system prompt[for HTML]?")
|
238 |
+
btn = antd.Button("send", type="primary", size="large")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
|
240 |
with antd.Flex(gap="small", wrap=True):
|
241 |
settingPromptBtn = antd.Button(
|
242 |
"⚙️ set system Prompt", type="default")
|
243 |
codeBtn = antd.Button("🧑💻 view code", type="default")
|
244 |
historyBtn = antd.Button("📜 history", type="default")
|
245 |
+
|
246 |
+
clear_btn = antd.Button("clear history", type="default", size="large")
|
247 |
|
248 |
with antd.Modal(open=False, title="set system Prompt", width="800px") as system_prompt_modal:
|
249 |
systemPromptInput = antd.InputTextarea(
|
|
|
271 |
history_drawer.close(lambda: gr.update(
|
272 |
open=False), inputs=[], outputs=[history_drawer])
|
273 |
|
274 |
+
# with antd.Col(span=24, md=16):
|
275 |
+
# with ms.Div(elem_classes="right_panel"):
|
276 |
+
# gr.HTML('<div class="render_header"><span class="header_btn"></span><span class="header_btn"></span><span class="header_btn"></span></div>')
|
277 |
+
# with antd.Tabs(active_key="empty", render_tab_bar="() => null") as state_tab:
|
278 |
+
# with antd.Tabs.Item(key="empty"):
|
279 |
+
# empty = antd.Empty(description="empty input", elem_classes="right_content")
|
280 |
+
# with antd.Tabs.Item(key="loading"):
|
281 |
+
# loading = antd.Spin(True, tip="coding...", size="large", elem_classes="right_content")
|
282 |
+
# with antd.Tabs.Item(key="render"):
|
283 |
+
# sandbox = gr.HTML(elem_classes="html_content")
|
284 |
with antd.Col(span=24, md=16):
|
285 |
with ms.Div(elem_classes="right_panel"):
|
286 |
gr.HTML('<div class="render_header"><span class="header_btn"></span><span class="header_btn"></span><span class="header_btn"></span></div>')
|
287 |
with antd.Tabs(active_key="empty", render_tab_bar="() => null") as state_tab:
|
288 |
+
with antd.Tabs.Item(key="empty", label="Render_empty"):
|
289 |
empty = antd.Empty(description="empty input", elem_classes="right_content")
|
290 |
+
with antd.Tabs.Item(key="loading", label="Render_loading"):
|
291 |
loading = antd.Spin(True, tip="coding...", size="large", elem_classes="right_content")
|
292 |
+
with antd.Tabs.Item(key="render_html", label="Render_HTML") as render_html:
|
293 |
sandbox = gr.HTML(elem_classes="html_content")
|
294 |
+
with antd.Tabs.Item(key="render_other", label="Render_Code") as render_other:
|
295 |
+
sandbox_other = legacy.Markdown()
|
296 |
|
297 |
+
def generation_code(query: Optional[str], use_system_prompt, _setting: Dict[str, str], _history: Optional[History]):
|
298 |
if query is None:
|
299 |
query = ''
|
300 |
if _history is None:
|
|
|
302 |
|
303 |
# Prepare the preprocess and postprocess functions
|
304 |
def preprocess(message, history):
|
305 |
+
if use_system_prompt:
|
306 |
+
messages = [{'role': 'system', 'content': _setting['system']}]
|
307 |
+
else:
|
308 |
+
messages = [{'role': 'system', 'content': ""}]
|
309 |
for user_msg, assistant_msg in history:
|
310 |
messages.append({'role': 'user', 'content': user_msg})
|
311 |
messages.append({'role': 'assistant', 'content': assistant_msg})
|
|
|
341 |
|
342 |
code = remove_code_block(assistant_response)
|
343 |
|
344 |
+
if "```html" in assistant_response:
|
345 |
+
sandbox_val = send_to_sandbox(code)
|
346 |
+
state_tab_val = gr.update(active_key="render_html")
|
347 |
+
render_html_val = gr.update(visible=True)
|
348 |
+
render_other_val = gr.update(visible=False)
|
349 |
+
sandbox_other_val = ""
|
350 |
+
else:
|
351 |
+
sandbox_val = ""
|
352 |
+
state_tab_val = gr.update(active_key="render_other")
|
353 |
+
render_html_val = gr.update(visible=False)
|
354 |
+
render_other_val = gr.update(visible=True)
|
355 |
+
sandbox_other_val = content
|
356 |
+
|
357 |
yield {
|
358 |
code_output: assistant_response,
|
359 |
history_state: local_history,
|
360 |
+
sandbox: sandbox_val,
|
361 |
+
state_tab: state_tab_val,
|
362 |
+
code_drawer: gr.update(open=False),
|
363 |
+
render_html: render_html_val,
|
364 |
+
render_other: render_other_val,
|
365 |
+
sandbox_other: sandbox_other_val,
|
366 |
}
|
367 |
+
# yield {
|
368 |
+
# code_output: assistant_response,
|
369 |
+
# history_state: local_history,
|
370 |
+
# sandbox: send_to_sandbox(code),
|
371 |
+
# state_tab: gr.update(active_key="render"),
|
372 |
+
# code_drawer: gr.update(open=False),
|
373 |
+
# }
|
374 |
+
|
375 |
+
def use_system_prompt_example_change(use_system_prompt):
|
376 |
+
return use_system_prompt
|
377 |
+
use_system_prompt_example.change(
|
378 |
+
fn=use_system_prompt_example_change,
|
379 |
+
inputs=[use_system_prompt_example],
|
380 |
+
outputs=[use_system_prompt],
|
381 |
+
)
|
382 |
+
def input_text_example_change(input_text_example):
|
383 |
+
return input_text_example
|
384 |
+
input_text_example.change(
|
385 |
+
fn=input_text_example_change,
|
386 |
+
inputs=[input_text_example],
|
387 |
+
outputs=[input],
|
388 |
+
)
|
389 |
+
|
390 |
btn.click(generation_code,
|
391 |
+
inputs=[input, use_system_prompt, setting, history_state],
|
392 |
+
outputs=[code_output, history_state, sandbox, state_tab, code_drawer,
|
393 |
+
render_html, render_other, sandbox_other])
|
394 |
|
395 |
clear_btn.click(clear_history, inputs=[], outputs=[history_state])
|
396 |
|
397 |
+
with gr.Row():
|
398 |
+
DESCRIPTION = f'### This demo from [SambaNova-Qwen2.5-Coder-Artifacts](https://huggingface.co/spaces/sambanovasystems/SambaNova-Qwen2.5-Coder-Artifacts). <br>'
|
399 |
+
DESCRIPTION += f'More examples from [FullStackBench](https://github.com/bytedance/FullStackBench). <br>'
|
400 |
+
DESCRIPTION += f'Thanks for their excellent work.'
|
401 |
+
gr.Markdown(DESCRIPTION)
|
402 |
+
|
403 |
if __name__ == "__main__":
|
404 |
+
demo.queue(default_concurrency_limit=20).launch(ssr_mode=False, show_api=False)
|
405 |
|