Spaces:
Sleeping
Sleeping
rosameliacarioni
commited on
Commit
·
6d635d0
1
Parent(s):
ae5112e
conversation starters
Browse files
app.py
CHANGED
@@ -1,13 +1,15 @@
|
|
1 |
from llama_cpp import Llama
|
2 |
import gradio as gr
|
3 |
|
|
|
4 |
llm = Llama.from_pretrained(
|
5 |
repo_id="rcarioniporras/model_modelcentric_llama_gguf",
|
6 |
filename="unsloth.Q4_K_M.gguf",
|
7 |
)
|
8 |
|
|
|
9 |
def predict(message, history):
|
10 |
-
messages = [{"role": "system", "content": "You are a helpful assistant."}]
|
11 |
for user_message, bot_message in history:
|
12 |
if user_message:
|
13 |
messages.append({"role": "user", "content": user_message})
|
@@ -25,7 +27,15 @@ def predict(message, history):
|
|
25 |
response += part
|
26 |
yield response
|
27 |
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
if __name__ == "__main__":
|
31 |
demo.launch()
|
|
|
1 |
from llama_cpp import Llama
|
2 |
import gradio as gr
|
3 |
|
4 |
+
|
5 |
llm = Llama.from_pretrained(
|
6 |
repo_id="rcarioniporras/model_modelcentric_llama_gguf",
|
7 |
filename="unsloth.Q4_K_M.gguf",
|
8 |
)
|
9 |
|
10 |
+
|
11 |
def predict(message, history):
|
12 |
+
messages = [{"role": "system", "content": "You are a helpful assistant who answers questions in a concise but thorough way. Prioritize clarity and usefulness in all interactions."}]
|
13 |
for user_message, bot_message in history:
|
14 |
if user_message:
|
15 |
messages.append({"role": "user", "content": user_message})
|
|
|
27 |
response += part
|
28 |
yield response
|
29 |
|
30 |
+
conversation_starters = [
|
31 |
+
{"text": "What is object-oriented programming (OOP), and what are its four main principles?"},
|
32 |
+
{"text": "Compare the stack and queue data structures."},
|
33 |
+
{"text": "Simplify the expression 3(x+4)−2(2x−1)."},
|
34 |
+
{"text": "What are some fun facts about space?"}
|
35 |
+
]
|
36 |
+
|
37 |
+
demo = gr.ChatInterface(predict, examples=conversation_starters, theme="Shivi/calm_seafoam")
|
38 |
+
|
39 |
|
40 |
if __name__ == "__main__":
|
41 |
demo.launch()
|