File size: 736 Bytes
fc3790e
db134f6
8896598
fc3790e
8896598
 
 
 
 
 
fc3790e
 
db134f6
fc3790e
 
 
 
db134f6
fc3790e
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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()