File size: 394 Bytes
4d880c5 6e6ab5c 7a6d53d 14ac0de 4d880c5 6e6ab5c 7a6d53d 6e6ab5c |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
from llama_cpp import Llama
# 直接从 Hugging Face 加载模型(避免存储问题)
llm = Llama.from_pretrained("YLX1965/medical-model", filename="unsloth.Q8_0.gguf")
def chat(prompt):
output = llm(prompt, max_tokens=200)
return output["choices"][0]["text"]
# 运行 Gradio
import gradio as gr
interface = gr.Interface(fn=chat, inputs="text", outputs="text")
interface.launch() |