File size: 852 Bytes
9e91841
200c557
9e91841
6084c6f
200c557
 
 
d1b608d
200c557
 
 
 
 
 
d1b608d
 
 
 
200c557
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import gradio as gr
from huggingface_hub import InferenceClient

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

def inference(message, history):
    partial_message = ""
    for token in client.text_generation(message, max_new_tokens=512, stream=True, do_sample=True):
        partial_message += token
        yield partial_message

gr.ChatInterface(
    inference,
    chatbot=gr.Chatbot(height=300),
    textbox=gr.Textbox(placeholder="你可以问我任何关于SequioaDB的问题!", container=False, scale=7),
    description="这是SequioaDB旗下的AI智能助手由Llama2-7b为原型打造.",
    title="SequioaDBAI智能助手",
    examples=["SequioaDB是什么?", "SequioaDB有哪些功能?"],
    retry_btn="重试",
    undo_btn="撤销",
    clear_btn="清除",
    submit_btn="提问",
).queue().launch()