File size: 1,313 Bytes
6305af6
 
 
25baccf
6305af6
f0d19fb
f9e7a93
30ebe1b
93ca049
30ebe1b
 
90794e8
e828597
633efff
 
6284875
61bca16
30ebe1b
 
 
 
6305af6
 
663e20e
6305af6
9ff4cec
8a459a3
 
6305af6
 
663e20e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import gradio as gr
from gradio_client import Client

client = Client("https://tonic1-tulu.hf.space/--replicas/rfqx9/")

def Tulu(user_input):
    system_prompt = "I am 🌷Tulu2 Created By Tonic-AI. I am a Very Helpful Assistant. I always provide a cautious answer and check my work."
    try:
        result = client.predict(
            user_input, 
            system_prompt,
            269,    # Max new tokens
            0.4,    # Temperature
            0.90,    # Top-p (nucleus sampling)
            0.90,    # Repetition penalty
            False,
            fn_index=0
        )
        return result
    except Exception as e:
        return f"An error occurred: {str(e)}"

iface = gr.Interface(
    fn=Tulu,  # Add the Tulu function here
    inputs=gr.Textbox(label="User Input"),
    outputs=gr.Textbox(label="Result"),
    title="👋🏻👋🏻Welcome to Tonic's 🌷Tulu2EasyChat",
    description="This app makes it easy for use [Tulu](https://huggingface.co/allenai/tulu-2-dpo-70b) and also to make a discordbot. Join us on our active [builder's server on discord](https://discord.gg/9XK7zXR7Ke) [add this space as a discord bot on your server](https://discord.com/oauth2/authorize?client_id=1176628808212828231&scope=bot+applications.commands&permissions=326417525824) ."
)

iface.launch()