Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -3,20 +3,25 @@ import gradio_client
|
|
3 |
from gradio_client import Client
|
4 |
|
5 |
title = """# Welcome To Tonic's Easy YI-6B-200K"""
|
6 |
-
description = """This is a [connector that looks like open ai](https://huggingface.co/spaces/Tonic1/TonicsYI-6B-200k) on the inputs , then ignores all that and connects to my [YI-6B-200K endpoint](https://huggingface.co/01-ai/Yi-6B-200K). This helps using [Yi for AGI here](https://huggingface.co/spaces/Tonic/AGYIntelligence)
|
7 |
-
|
|
|
|
|
8 |
def chat_api_interface(messages, model, frequency_penalty=0, logit_bias=None, max_tokens=None, n=1, presence_penalty=0, response_format="text", seed=None, stop=None, stream=False, temperature=0.9, top_p=1, tools=None, tool_choice="none", user=None):
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
20 |
|
21 |
with gr.Blocks() as demo:
|
22 |
with gr.Row():
|
|
|
3 |
from gradio_client import Client
|
4 |
|
5 |
title = """# Welcome To Tonic's Easy YI-6B-200K"""
|
6 |
+
description = """This is a [connector that looks like open ai](https://huggingface.co/spaces/Tonic1/TonicsYI-6B-200k) on the inputs , then ignores all that and connects to my [YI-6B-200K endpoint](https://huggingface.co/01-ai/Yi-6B-200K). This helps using [Yi for AGI here](https://huggingface.co/spaces/Tonic/AGYIntelligence)
|
7 |
+
Join us : 🌟TeamTonic🌟 is always making cool demos! Join our active builder's🛠️community on 👻Discord: [Discord](https://discord.gg/nXx5wbX9) On 🤗Huggingface: [TeamTonic](https://huggingface.co/TeamTonic) & [MultiTransformer](https://huggingface.co/MultiTransformer) On 🌐Github: [Polytonic](https://github.com/tonic-ai) & contribute to 🌟 [PolyGPT](https://github.com/tonic-ai/polygpt-alpha)
|
8 |
+
"""
|
9 |
+
client = Client("https://tonic1-tonicsyi-6b-200k.hf.space/--replicas/ggpbv/")
|
10 |
def chat_api_interface(messages, model, frequency_penalty=0, logit_bias=None, max_tokens=None, n=1, presence_penalty=0, response_format="text", seed=None, stop=None, stream=False, temperature=0.9, top_p=1, tools=None, tool_choice="none", user=None):
|
11 |
+
try:
|
12 |
+
result = client.predict(
|
13 |
+
your_message=messages,
|
14 |
+
system_prompt="",
|
15 |
+
max_new_tokens=16000,
|
16 |
+
temperature=temperature,
|
17 |
+
top_p=top_p,
|
18 |
+
top_k=presence_penalty,
|
19 |
+
disable_for_faster_inference=False,
|
20 |
+
api_name="/predict"
|
21 |
+
)
|
22 |
+
return result
|
23 |
+
except Exception as e:
|
24 |
+
return f"An error occurred: {str(e)}"
|
25 |
|
26 |
with gr.Blocks() as demo:
|
27 |
with gr.Row():
|