import gradio as gr from transformers import pipeline # 加載模型 model = pipeline("text-generation", model="taide/Llama3-TAIDE-LX-8B-Chat-Alpha1") # 定義輸入和輸出 def generate_text(prompt): return model(prompt, max_length=500, temperature=0.2) # 設置 Gradio 接口 iface = gr.Interface(fn=generate_text, inputs="text", outputs="text") iface.launch()