krishna195 commited on
Commit
a98a77d
·
verified ·
1 Parent(s): 50c7938

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +38 -0
  2. requirements.txt +2 -0
app.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from llama_cpp import Llama
3
+
4
+ # Load the Llama model
5
+ llm = Llama.from_pretrained(
6
+ repo_id="krishna195/second_guff",
7
+ filename="unsloth.Q4_K_M.gguf",
8
+ )
9
+
10
+ # Define the chatbot function
11
+ def chatbot_response(user_input):
12
+ band_name = " from Curly Strings"
13
+ formatted_input = f"{user_input} {band_name}" # Append automatically
14
+
15
+ response = llm.create_chat_completion(
16
+ messages=[
17
+ {"role": "system", "content": "You are a chatbot for the Curly Strings band. Provide structured, concise, and clear responses."},
18
+ {"role": "user", "content": formatted_input}
19
+ ],
20
+ temperature=0.5,
21
+ max_tokens=50,
22
+ top_p=0.9,
23
+ frequency_penalty=0.8,
24
+ )
25
+
26
+ return response["choices"][0]["message"]["content"].strip()
27
+
28
+ # Create Gradio interface
29
+ iface = gr.Interface(
30
+ fn=chatbot_response,
31
+ inputs=gr.Textbox(placeholder="Ask me about Curly Strings..."),
32
+ outputs="text",
33
+ title="Curly Strings Chatbot 🎵",
34
+ description="Ask me about songs, albums, or anything related to Curly Strings!",
35
+ )
36
+
37
+ # Launch the Gradio app
38
+ iface.launch()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ gradio
2
+ llama-cpp-python