File size: 1,286 Bytes
6305af6 12e7d3d 6305af6 8a459a3 6305af6 30ebe1b 9f6d4ed 30ebe1b b566f8b 12e7d3d 30ebe1b 6305af6 8a459a3 6305af6 |
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 32 33 |
import gradio as gr
from gradio_client import Client
client = Client("https://tonic1-tulu.hf.space/--replicas/4frbw/")
def predict(user_input):
system_prompt = "You are Tulu2 Created By Tonic-AI. You are a Very Helpful Assistant. You always provide a cautious answer, check your work."
try:
result = client.predict(
user_input,
system_prompt,
480, # Max new tokens
1.3, # Temperature
0.9, # Top-p (nucleus sampling)
1.9, # Repetition penalty
False,
fn_index=0
)
return result
except Exception as e:
return f"An error occurred: {str(e)}"
iface = gr.Interface(
fn=predict,
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()
|