Tonic commited on
Commit
abf0eee
1 Parent(s): 55aab05

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -13
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
- client = Client("https://tonic1-tonicsyi-6b-200k.hf.space/--replicas/cvjqf/")
 
 
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
- result = client.predict(
10
- your_message = messages,
11
- system_prompt = "I am YiTonic, an AI language model created by Tonic-AI. I am a cautious assistant. I carefully follow instructions. I am helpful and harmless and I follow ethical guidelines and promote positive behavior.",
12
- max_new_tokens = 16000,
13
- temperature,
14
- top_p,
15
- top_k,
16
- disable_for_faster_inference=False,
17
- api_name="/predict"
18
- )
19
- return result
 
 
 
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():