Mykes commited on
Commit
0ffcc97
1 Parent(s): 5e7f7b8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -5
app.py CHANGED
@@ -1,15 +1,34 @@
1
  import streamlit as st
2
- from ctransformers import AutoModelForCausalLM, AutoTokenizer
 
 
 
 
 
 
3
 
4
- model = AutoModelForCausalLM.from_pretrained("Mykes/med_gemma7b_gguf", model_file="unsloth.Q4_K_M.gguf")
5
- tokenizer = AutoTokenizer.from_pretrained(model)
6
  input_text = st.textarea('text')
7
  if text:
8
- input_ids = tokenizer(input_text, return_tensors="pt")
9
- outputs = model.generate(**input_ids)
 
 
 
 
10
  st.write(outputs)
11
 
12
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  # from transformers import AutoTokenizer, AutoModelForCausalLM
15
 
 
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
+ )
9
 
 
 
10
  input_text = st.textarea('text')
11
  if text:
12
+ output = llm(
13
+ input_text, # Prompt
14
+ max_tokens=32, # Generate up to 32 tokens, set to None to generate up to the end of the context window
15
+ stop=["Q:", "\n"], # Stop generating just before the model would generate a new question
16
+ echo=True # Echo the prompt back in the output
17
+ ) # Generate a completion, can also call create_completion
18
  st.write(outputs)
19
 
20
 
21
+ # from ctransformers import AutoModelForCausalLM, AutoTokenizer
22
+
23
+ # model = AutoModelForCausalLM.from_pretrained("Mykes/med_gemma7b_gguf", model_file="unsloth.Q4_K_M.gguf")
24
+ # tokenizer = AutoTokenizer.from_pretrained(model)
25
+ # input_text = st.textarea('text')
26
+ # if text:
27
+ # input_ids = tokenizer(input_text, return_tensors="pt")
28
+ # outputs = model.generate(**input_ids)
29
+ # st.write(outputs)
30
+
31
+
32
 
33
  # from transformers import AutoTokenizer, AutoModelForCausalLM
34