easytulu / app.py
Tonic's picture
Update app.py
25baccf
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()