Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from gradio_client import Client
|
3 |
+
|
4 |
+
client = Client("https://tonic1-tonicsorca2.hf.space/--replicas/fskmf/")
|
5 |
+
|
6 |
+
def predict(user_input):
|
7 |
+
system_prompt = "You are Orca2 Created By Tonic-AI. You are a Very Helpful Assistant. You always provide a cautious answer, check your work, provide a long detailed answer.[/INST]"
|
8 |
+
|
9 |
+
result = client.predict(
|
10 |
+
user_input,
|
11 |
+
system_prompt,
|
12 |
+
256, # int | float (numeric value between 25 and 256) in 'Max new tokens' Slider component
|
13 |
+
0.05, # int | float (numeric value between 0.05 and 1.0) in 'Temperature' Slider component
|
14 |
+
0.9, # int | float (numeric value between 0.01 and 0.99) in 'Top-p (nucleus sampling)' Slider component
|
15 |
+
1.9, # int | float (numeric value between 1.0 and 2.0) in 'Repetition penalty' Slider component
|
16 |
+
api_name="/predict"
|
17 |
+
)
|
18 |
+
|
19 |
+
return result
|
20 |
+
|
21 |
+
iface = gr.Interface(
|
22 |
+
fn=predict,
|
23 |
+
inputs=gr.Textbox(label="User Input"),
|
24 |
+
outputs=gr.Textbox(label="Result"),
|
25 |
+
title="👋🏻👋🏻Welcome to Tonic's Orca2_EasyChat",
|
26 |
+
description="This app makes it easy for use [microsoft/Orca-2-13b](https://huggingface.co/microsoft/Orca-2-13b) 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) ."
|
27 |
+
)
|
28 |
+
|
29 |
+
iface.launch()
|