Spaces:
Runtime error
Runtime error
Update chain_app.py
Browse files- chain_app.py +61 -2
chain_app.py
CHANGED
|
@@ -1030,6 +1030,34 @@ async def chat_profile():
|
|
| 1030 |
|
| 1031 |
]
|
| 1032 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1033 |
# # cl.ChatProfile(
|
| 1034 |
# # name="Toka-353M",
|
| 1035 |
# # markdown_description="PartAI Open Source model Toka with 353M parameters",
|
|
@@ -1975,6 +2003,26 @@ async def on_chat_start():
|
|
| 1975 |
),
|
| 1976 |
]
|
| 1977 |
).send()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1978 |
# await cl.Message(
|
| 1979 |
# content="Im Mistral nemo 12B .i was configured by Artin Daneshvar and Sadra Noadoust, 2 iranian students to help you, how can i assist you today ? "
|
| 1980 |
# ).send()
|
|
@@ -2530,7 +2578,7 @@ async def main(message: cl.Message):
|
|
| 2530 |
token=f"{hf_token_llama_3_1}",
|
| 2531 |
)
|
| 2532 |
result = client.chat_completion(
|
| 2533 |
-
messages=[{"role": "user", "content":
|
| 2534 |
max_tokens=500,
|
| 2535 |
)
|
| 2536 |
|
|
@@ -2538,7 +2586,18 @@ async def main(message: cl.Message):
|
|
| 2538 |
content=result.choices[0].message.content,
|
| 2539 |
).send()
|
| 2540 |
|
| 2541 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2542 |
|
| 2543 |
# elif chat_profile == 'Toka-353M':
|
| 2544 |
# output = query({
|
|
|
|
| 1030 |
|
| 1031 |
]
|
| 1032 |
),
|
| 1033 |
+
cl.ChatProfile(
|
| 1034 |
+
name='Yi-1.5-34B',
|
| 1035 |
+
markdown_description = 'Yi-1.5 34B from 01-AI',
|
| 1036 |
+
starters=[
|
| 1037 |
+
cl.Starter(
|
| 1038 |
+
label="Morning routine ideation",
|
| 1039 |
+
message="Can you help me create a personalized morning routine that would help increase my productivity throughout the day? Start by asking me about my current habits and what activities energize me in the morning.",
|
| 1040 |
+
icon="https://chainlit-rag-copilot-r2xd.onrender.com/public/idea.svg",
|
| 1041 |
+
),
|
| 1042 |
+
|
| 1043 |
+
cl.Starter(
|
| 1044 |
+
label="Explain superconductors",
|
| 1045 |
+
message="Explain superconductors like I'm five years old.",
|
| 1046 |
+
icon="https://chainlit-rag-copilot-r2xd.onrender.com/public/learn.svg",
|
| 1047 |
+
),
|
| 1048 |
+
cl.Starter(
|
| 1049 |
+
label="Python script for daily email reports",
|
| 1050 |
+
message="Write a script to automate sending daily email reports in Python, and walk me through how I would set it up.",
|
| 1051 |
+
icon="https://chainlit-rag-copilot-r2xd.onrender.com/public/terminal.svg",
|
| 1052 |
+
),
|
| 1053 |
+
cl.Starter(
|
| 1054 |
+
label="Text inviting friend to wedding",
|
| 1055 |
+
message="Write a text asking a friend to be my plus-one at a wedding next month. I want to keep it super short and casual, and offer an out.",
|
| 1056 |
+
icon="https://chainlit-rag-copilot-r2xd.onrender.com/public/write.svg",
|
| 1057 |
+
)
|
| 1058 |
+
|
| 1059 |
+
]
|
| 1060 |
+
),
|
| 1061 |
# # cl.ChatProfile(
|
| 1062 |
# # name="Toka-353M",
|
| 1063 |
# # markdown_description="PartAI Open Source model Toka with 353M parameters",
|
|
|
|
| 2003 |
),
|
| 2004 |
]
|
| 2005 |
).send()
|
| 2006 |
+
|
| 2007 |
+
if chat_profile == 'Yi-1.5-34B':
|
| 2008 |
+
await cl.ChatSettings(
|
| 2009 |
+
[
|
| 2010 |
+
Select(
|
| 2011 |
+
id="01AI-Model",
|
| 2012 |
+
label="01AI - Model",
|
| 2013 |
+
values=["Yi-1.5-34B"],
|
| 2014 |
+
initial_index=0,
|
| 2015 |
+
),
|
| 2016 |
+
Slider(
|
| 2017 |
+
id="Temperature",
|
| 2018 |
+
label="Model Temperature",
|
| 2019 |
+
initial=0.7,
|
| 2020 |
+
min=0,
|
| 2021 |
+
max=1,
|
| 2022 |
+
step=0.1,
|
| 2023 |
+
),
|
| 2024 |
+
]
|
| 2025 |
+
).send()
|
| 2026 |
# await cl.Message(
|
| 2027 |
# content="Im Mistral nemo 12B .i was configured by Artin Daneshvar and Sadra Noadoust, 2 iranian students to help you, how can i assist you today ? "
|
| 2028 |
# ).send()
|
|
|
|
| 2578 |
token=f"{hf_token_llama_3_1}",
|
| 2579 |
)
|
| 2580 |
result = client.chat_completion(
|
| 2581 |
+
messages=[{"role": "user", "content": message.content}],
|
| 2582 |
max_tokens=500,
|
| 2583 |
)
|
| 2584 |
|
|
|
|
| 2586 |
content=result.choices[0].message.content,
|
| 2587 |
).send()
|
| 2588 |
|
| 2589 |
+
elif chat_profile == 'Yi-1.5-34B':
|
| 2590 |
+
client = InferenceClient(
|
| 2591 |
+
"01-ai/Yi-1.5-34B-Chat",
|
| 2592 |
+
token=f'{hf_token_llama_3_1}',
|
| 2593 |
+
)
|
| 2594 |
+
result = client.chat_completion(
|
| 2595 |
+
messages=[{"role": "user", "content": message.content}],
|
| 2596 |
+
max_tokens=500,
|
| 2597 |
+
)
|
| 2598 |
+
await cl.Message(
|
| 2599 |
+
content=result.choices[0].message.content,
|
| 2600 |
+
).send()
|
| 2601 |
|
| 2602 |
# elif chat_profile == 'Toka-353M':
|
| 2603 |
# output = query({
|