Files changed (1) hide show
  1. app.py +4 -11
app.py CHANGED
@@ -1,23 +1,16 @@
1
  import gradio as gr
2
  from llama_cpp import Llama
3
 
4
- # Link to the model in another Hugging Face repository
5
- repo_name = "google/gemma-7b-it-GGUF"
6
- model_path = "gemma-7b-it-gguf" # Ensure this matches the actual file name in the repo
7
- model = Llama(hf_repo=repo_name, hf_file=model_path, n_ctx=512) # No need to worry about downloading manually
8
 
9
- # Define the chatbot function
10
  def chat(input_text):
11
- output = model(input_text, max_tokens=150, temperature=0.7, top_p=0.9)
12
  return output["choices"][0]["text"]
13
 
14
- # Create the Gradio interface
15
  interface = gr.Interface(
16
  fn=chat,
17
  inputs="text",
18
- outputs="text",
19
- title="Gemma 7B Instruct GGUF Chatbot allowed for Space Use by @mikemin027"
20
  )
21
 
22
- # Launch the interface
23
- interface.launch()
 
1
  import gradio as gr
2
  from llama_cpp import Llama
3
 
4
+ model = Llama.from_pretrained(repo_id="google/gemma-7b-it-GGUF", filename="gemma-7b-it.gguf")
 
 
 
5
 
 
6
  def chat(input_text):
7
+ 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"])
8
  return output["choices"][0]["text"]
9
 
 
10
  interface = gr.Interface(
11
  fn=chat,
12
  inputs="text",
13
+ outputs="text"
 
14
  )
15
 
16
+ interface.launch()