File size: 303 Bytes
91180dc
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
from transformers import pipeline
import gradio as gr

pipe = pipeline("text-generation", model="yentinglin/Taiwan-LLM-7B-v2.0.1-chat")

def chat_fn(prompt):
    return pipe(prompt, max_new_tokens=200)[0]["generated_text"]

iface = gr.Interface(fn=chat_fn, inputs="text", outputs="text")
iface.launch()