File size: 1,193 Bytes
27aefd0
 
 
b5710e1
27aefd0
8ad5f48
254acea
675a652
 
 
 
 
 
27aefd0
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
from huggingface_hub import InferenceClient

client = InferenceClient(model="https://zgg3nzdpswxy4a-80.proxy.runpod.net")

def inference(message, history):
    return client.text_generation(prompt=message, details=True, max_new_tokens=256, stream=False, 
                                        temperature=0.5, do_sample=True, top_p=0.9)
    # partial_message = ""
    # for token in client.text_generation(message, max_new_tokens=256, stream=False, 
    #                                     temperature=0.5, do_sample=True, top_p=0.9):
    #     partial_message += token
    #     yield partial_message

gr.ChatInterface(
    inference,
    chatbot=gr.Chatbot(height=300, scale=7),
    textbox=gr.Textbox(placeholder="你可以问我任何关于SequioaDB的问题!", container=False, scale=7),
    description="这是SequioaDB旗下的AI智能大语言模型,训练超过上万条真实数据和7亿参数。",
    title="ChatSDB",
    examples=["SequoiaDB巨杉数据库是什么?", "SequoiaDB巨杉数据库支持哪些类型的数据库实例?"],
    retry_btn="重试",
    undo_btn="撤销",
    clear_btn="清除",
    submit_btn="提问",
).queue().launch()