Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -2,10 +2,18 @@ from huggingface_hub import InferenceClient
|
|
2 |
import gradio as gr
|
3 |
import random
|
4 |
import prompts
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
def format_prompt(message, history):
|
10 |
prompt = "<s>"
|
11 |
for user_prompt, bot_response in history:
|
@@ -27,10 +35,10 @@ agents =[
|
|
27 |
|
28 |
]
|
29 |
def generate(
|
30 |
-
prompt, history, agent_name=agents[0], sys_prompt="", temperature=0.9, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0,
|
31 |
):
|
32 |
seed = random.randint(1,1111111111111111)
|
33 |
-
|
34 |
agent=prompts.WEB_DEV
|
35 |
if agent_name == "WEB_DEV":
|
36 |
agent = prompts.WEB_DEV_SYSTEM_PROMPT
|
@@ -78,6 +86,13 @@ def generate(
|
|
78 |
|
79 |
|
80 |
additional_inputs=[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
gr.Dropdown(
|
82 |
label="Agents",
|
83 |
choices=[s for s in agents],
|
|
|
2 |
import gradio as gr
|
3 |
import random
|
4 |
import prompts
|
5 |
+
clients = [
|
6 |
+
{'type':'image','name':'black-forest-labs/FLUX.1-dev','rank':'op','max_tokens':16384,'schema':{'bos':'<|im_start|>','eos':'<|im_end|>'}},
|
7 |
+
{'type':'text','name':'deepseek-ai/DeepSeek-V2.5-1210','rank':'op','max_tokens':16384,'schema':{'bos':'<|im_start|>','eos':'<|im_end|>'}},
|
8 |
+
{'type':'text','name':'Qwen/Qwen2.5-Coder-32B-Instruct','rank':'op','max_tokens':32768,'schema':{'bos':'<|im_start|>','eos':'<|im_end|>'}},
|
9 |
+
{'type':'text','name':'meta-llama/Meta-Llama-3-8B','rank':'op','max_tokens':32768,'schema':{'bos':'<|im_start|>','eos':'<|im_end|>'}},
|
10 |
+
{'type':'text','name':'Snowflake/snowflake-arctic-embed-l-v2.0','rank':'op','max_tokens':4096,'schema':{'bos':'<|im_start|>','eos':'<|im_end|>'}},
|
11 |
+
{'type':'text','name':'Snowflake/snowflake-arctic-embed-m-v2.0','rank':'op','max_tokens':4096,'schema':{'bos':'<|im_start|>','eos':'<|im_end|>'}},
|
12 |
+
{'type':'text','name':'HuggingFaceTB/SmolLM2-1.7B-Instruct','rank':'op','max_tokens':4096,'schema':{'bos':'<|im_start|>','eos':'<|im_end|>'}},
|
13 |
+
{'type':'text','name':'Qwen/QwQ-32B-Preview','rank':'op','max_tokens':16384,'schema':{'bos':'<|im_start|>','eos':'<|im_end|>'}},
|
14 |
+
{'type':'text','name':'meta-llama/Llama-3.3-70B-Instruct','rank':'pro','max_tokens':16384,'schema':{'bos':'<|im_start|>','eos':'<|im_end|>'}},
|
15 |
+
{'type':'text','name':'mistralai/Mixtral-8x7B-Instruct-v0.1','rank':'op','max_tokens':40000,'schema':{'bos':'<s>','eos':'</s>'}},
|
16 |
+
]
|
17 |
def format_prompt(message, history):
|
18 |
prompt = "<s>"
|
19 |
for user_prompt, bot_response in history:
|
|
|
35 |
|
36 |
]
|
37 |
def generate(
|
38 |
+
prompt, history, mod, agent_name=agents[0], sys_prompt="", temperature=0.9, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0,
|
39 |
):
|
40 |
seed = random.randint(1,1111111111111111)
|
41 |
+
client=InferenceClient(clients[int(mod)]['name'])
|
42 |
agent=prompts.WEB_DEV
|
43 |
if agent_name == "WEB_DEV":
|
44 |
agent = prompts.WEB_DEV_SYSTEM_PROMPT
|
|
|
86 |
|
87 |
|
88 |
additional_inputs=[
|
89 |
+
gr.Dropdown(
|
90 |
+
label="Model",
|
91 |
+
choices=[sn['name'] for sn in clients],
|
92 |
+
value=clients[2]['name'],
|
93 |
+
interactive=True,
|
94 |
+
type='index',
|
95 |
+
),
|
96 |
gr.Dropdown(
|
97 |
label="Agents",
|
98 |
choices=[s for s in agents],
|