File size: 583 Bytes
0837817
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr
from transformers import pipeline

pipe = pipeline("text2text-generation", model="lmsys/fastchat-t5-3b-v1.0")

def predict(text, history):
   
    return pipe(text)[0]["generated_text"]
  


gr.ChatInterface(
    fn = predict,
    chatbot=gr.Chatbot(height=800),
    textbox=gr.Textbox(placeholder="<Your question>", container=False, scale=7),
    title="Enter your question",
    description="Ask a question to the following model: lmsys/fastchat-t5-3b-v1.0",
    theme="soft",
    retry_btn=None,
    undo_btn="Delete Previous",
    clear_btn="Clear"
).launch()