mikemin027 commited on
Commit
0238ed4
1 Parent(s): 3beb7c1

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from llama_cpp import Llama
3
+
4
+ # Load the GGUF model using llama.cpp Python bindings
5
+ model_path = "google/gemma-7b-it-GGUF.bin" # Adjust the path as needed
6
+ model = Llama(model_path=model_path, n_ctx=512)
7
+
8
+ # Define the chatbot function
9
+ def chat(input_text):
10
+ output = model(input_text, max_tokens=150, temperature=0.7, top_p=0.9)
11
+ return output["choices"][0]["text"]
12
+
13
+ # Create the Gradio interface
14
+ interface = gr.Interface(
15
+ fn=chat,
16
+ inputs="text",
17
+ outputs="text",
18
+ title="Gemma 7B Chatbot"
19
+ )
20
+
21
+ # Launch the interface
22
+ interface.launch()