processing_test / app.py
Mori-kamiyama's picture
Pytorchからllama.cppに変更
8896598
raw
history blame
736 Bytes
import gradio as gr
from llama_cpp import Llama
from huggingface_hub import hf_hub_download
# Hugging Face上のリポジトリからモデルをダウンロードする
# repo_id はモデルが置かれているリポジトリのID、filename はモデルファイル名です
model_path = hf_hub_download(repo_id="Mori-kamiyama/sarashina2-13b-r1", filename="model.gguf")
# ダウンロードされたパスを使ってモデルをロード
llm = Llama(model_path=model_path)
def generate_text(prompt):
return llm(prompt)
iface = gr.Interface(fn=generate_text,
inputs="text",
outputs="text",
title="GGUFモデルテキストジェネレーター")
iface.launch()