alibidaran commited on
Commit
8ad47fe
·
verified ·
1 Parent(s): d220608

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -7
app.py CHANGED
@@ -6,6 +6,12 @@ import time
6
  #import pandas as pd
7
  global Modelfile # Declare Modelfile as a global variable
8
 
 
 
 
 
 
 
9
 
10
  #def Generate_report(history,model_flags):
11
  # data={'steps':model_flags,
@@ -18,14 +24,13 @@ def user(user_message,history):
18
  return "", history+[{'role': 'user', 'content':user_message}]
19
  def respond(history):
20
  text=f"<s> ###Human: {history[-1]['content']} ###Asistant: "
21
- response=ollama.generate(
22
- model='hf.co/alibidaran/LLAMA3.2-Virtual_doctor_GGUF:latest',
23
- prompt=text,
24
- stream=False,
25
- )
26
- print(response['response'])
27
  history.append({'role':'assistant','content':""})
28
- for character in response['response']:
29
  history[-1]['content']+=character
30
  time.sleep(0.02)
31
  yield history
 
6
  #import pandas as pd
7
  global Modelfile # Declare Modelfile as a global variable
8
 
9
+ from llama_cpp import Llama
10
+
11
+ llm = Llama.from_pretrained(
12
+ repo_id="alibidaran/LLAMA3.2-Virtual_doctor_GGUF",
13
+ filename="unsloth.Q8_0.gguf",
14
+ )
15
 
16
  #def Generate_report(history,model_flags):
17
  # data={'steps':model_flags,
 
24
  return "", history+[{'role': 'user', 'content':user_message}]
25
  def respond(history):
26
  text=f"<s> ###Human: {history[-1]['content']} ###Asistant: "
27
+ response=llm(text,
28
+ max_tokens=512,
29
+ echo=True)
30
+ response=response['choice'][0]['text']
31
+ print(response)
 
32
  history.append({'role':'assistant','content':""})
33
+ for character in response:
34
  history[-1]['content']+=character
35
  time.sleep(0.02)
36
  yield history