Mykes commited on
Commit
5fc4fcc
1 Parent(s): 7e823be

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -8
app.py CHANGED
@@ -1,14 +1,26 @@
1
  import streamlit as st
2
  from llama_cpp import Llama
3
 
4
- llm = Llama.from_pretrained(
5
- repo_id="Mykes/med_gemma7b_gguf",
6
- filename="*Q4_K_M.gguf",
7
- verbose=False,
8
- n_ctx=512,
9
- n_batch=512,
10
- n_threads=4
11
- )
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
  basic_prompt = "Below is the context which is your conversation history and the last user question. Write a response according the context and question. ### Context: user: Ответь мне на вопрос о моем здоровье. assistant: Конечно! Какой у Вас вопрос? ### Question: {question} ### Response:"
14
  input_text = st.text_input('text')
 
1
  import streamlit as st
2
  from llama_cpp import Llama
3
 
4
+ # llm = Llama.from_pretrained(
5
+ # repo_id="Mykes/med_gemma7b_gguf",
6
+ # filename="*Q4_K_M.gguf",
7
+ # verbose=False,
8
+ # n_ctx=512,
9
+ # n_batch=512,
10
+ # n_threads=4
11
+ # )
12
+ @st.cache_resource
13
+ def load_model():
14
+ return Llama.from_pretrained(
15
+ repo_id="Mykes/med_gemma7b_gguf",
16
+ filename="*Q4_K_M.gguf",
17
+ verbose=False,
18
+ n_ctx=256,
19
+ n_batch=256,
20
+ n_threads=4
21
+ )
22
+
23
+ llm = load_model()
24
 
25
  basic_prompt = "Below is the context which is your conversation history and the last user question. Write a response according the context and question. ### Context: user: Ответь мне на вопрос о моем здоровье. assistant: Конечно! Какой у Вас вопрос? ### Question: {question} ### Response:"
26
  input_text = st.text_input('text')