File size: 452 Bytes
0238ed4
 
8e2da53
0238ed4
756cabf
0238ed4
 
756cabf
0238ed4
 
 
 
 
 
 
 
8e2da53
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import gradio as gr
from llama_cpp import Llama
import os

model = Llama.from_pretrained(repo_id="google/gemma-7b-it-GGUF", filename="gemma-7b-it.gguf")

def chat(input_text):
    output = model(f"<bos><start_of_turn>user\n{input_text}<end_of_turn>\n<start_of_turn>model\n", stop=["<start_of_turn>model", "\n"])
    return output["choices"][0]["text"]

interface = gr.Interface(
    fn=chat,
    inputs="text",
    outputs="text",
)

interface.launch()