Commit
·
4a3b90e
1
Parent(s):
abed28c
update app.py
Browse files
app.py
CHANGED
|
@@ -316,7 +316,7 @@ with gr.Blocks(css_paths="app.css", title="Qwen2.5 Coder Artifacts (+SambaNova+F
|
|
| 316 |
|
| 317 |
input = antd.InputTextarea(size="middle", allow_clear=True, placeholder="Please enter what kind of application you want")
|
| 318 |
code_language = gr.Textbox(label="code language", lines=1)
|
| 319 |
-
|
| 320 |
choices=[
|
| 321 |
"Qwen2.5-Coder-32B-Instruct",
|
| 322 |
"DeepSeek-R1-Distill-Llama-70B",
|
|
@@ -383,15 +383,15 @@ with gr.Blocks(css_paths="app.css", title="Qwen2.5 Coder Artifacts (+SambaNova+F
|
|
| 383 |
sandbox_other = legacy.Markdown()
|
| 384 |
code_syntax_check = gr.Textbox(label="check code syntax: ", lines=1, interactive=False)
|
| 385 |
with gr.Row(visible=False) as think_content_row:
|
| 386 |
-
think_content = gr.Textbox(label="think_content: ", lines=10
|
| 387 |
|
| 388 |
-
def generation_code(query: Optional[str], code_language, _setting: Dict[str, str], _history: Optional[History],
|
| 389 |
if query is None:
|
| 390 |
query = ''
|
| 391 |
if _history is None:
|
| 392 |
_history = []
|
| 393 |
|
| 394 |
-
logger.info(f"code_language/query={code_language}/{
|
| 395 |
|
| 396 |
# Prepare the preprocess and postprocess functions
|
| 397 |
def preprocess(message, history):
|
|
@@ -410,7 +410,7 @@ with gr.Blocks(css_paths="app.css", title="Qwen2.5 Coder Artifacts (+SambaNova+F
|
|
| 410 |
|
| 411 |
# Get the model from sambanova_gradio
|
| 412 |
fn = get_fn(
|
| 413 |
-
model_name=
|
| 414 |
preprocess=preprocess,
|
| 415 |
postprocess=postprocess,
|
| 416 |
api_key=YOUR_API_TOKEN
|
|
@@ -486,7 +486,7 @@ with gr.Blocks(css_paths="app.css", title="Qwen2.5 Coder Artifacts (+SambaNova+F
|
|
| 486 |
)
|
| 487 |
|
| 488 |
btn.click(generation_code,
|
| 489 |
-
inputs=[input, code_language, setting, history_state,
|
| 490 |
outputs=[code_output, history_state, sandbox, state_tab, code_drawer,
|
| 491 |
render_html, render_other, sandbox_other, code_syntax_check, think_content, think_content_row])
|
| 492 |
|
|
|
|
| 316 |
|
| 317 |
input = antd.InputTextarea(size="middle", allow_clear=True, placeholder="Please enter what kind of application you want")
|
| 318 |
code_language = gr.Textbox(label="code language", lines=1)
|
| 319 |
+
llm_model = gr.Dropdown(
|
| 320 |
choices=[
|
| 321 |
"Qwen2.5-Coder-32B-Instruct",
|
| 322 |
"DeepSeek-R1-Distill-Llama-70B",
|
|
|
|
| 383 |
sandbox_other = legacy.Markdown()
|
| 384 |
code_syntax_check = gr.Textbox(label="check code syntax: ", lines=1, interactive=False)
|
| 385 |
with gr.Row(visible=False) as think_content_row:
|
| 386 |
+
think_content = gr.Textbox(label="think_content: ", lines=10)
|
| 387 |
|
| 388 |
+
def generation_code(query: Optional[str], code_language, _setting: Dict[str, str], _history: Optional[History], llm_model):
|
| 389 |
if query is None:
|
| 390 |
query = ''
|
| 391 |
if _history is None:
|
| 392 |
_history = []
|
| 393 |
|
| 394 |
+
logger.info(f"code_language/query={code_language}/{llm_model}/")
|
| 395 |
|
| 396 |
# Prepare the preprocess and postprocess functions
|
| 397 |
def preprocess(message, history):
|
|
|
|
| 410 |
|
| 411 |
# Get the model from sambanova_gradio
|
| 412 |
fn = get_fn(
|
| 413 |
+
model_name=llm_model,
|
| 414 |
preprocess=preprocess,
|
| 415 |
postprocess=postprocess,
|
| 416 |
api_key=YOUR_API_TOKEN
|
|
|
|
| 486 |
)
|
| 487 |
|
| 488 |
btn.click(generation_code,
|
| 489 |
+
inputs=[input, code_language, setting, history_state, llm_model],
|
| 490 |
outputs=[code_output, history_state, sandbox, state_tab, code_drawer,
|
| 491 |
render_html, render_other, sandbox_other, code_syntax_check, think_content, think_content_row])
|
| 492 |
|