Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ from ctransformers import AutoModelForCausalLM
|
|
3 |
from transformers import AutoTokenizer, pipeline
|
4 |
import torch
|
5 |
import re
|
|
|
6 |
|
7 |
# Initialize the model
|
8 |
model = AutoModelForCausalLM.from_pretrained("Detsutut/Igea-1B-instruct-v0.2-GGUF", model_file="unsloth.Q4_K_M.gguf", model_type="mistral", hf=True)
|
@@ -15,6 +16,16 @@ gen_pipeline = pipeline(
|
|
15 |
tokenizer=tokenizer
|
16 |
)
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
alpaca_instruct_prompt = """{}
|
19 |
|
20 |
### Istruzione:
|
@@ -29,7 +40,7 @@ def generate_text(input_text, max_new_tokens=100, temperature=1, system_prompt="
|
|
29 |
if len(system_prompt)>0:
|
30 |
system_str = system_prompt
|
31 |
else:
|
32 |
-
system_str =
|
33 |
|
34 |
prompt = alpaca_instruct_prompt.format(system_str, input_text,"")
|
35 |
|
|
|
3 |
from transformers import AutoTokenizer, pipeline
|
4 |
import torch
|
5 |
import re
|
6 |
+
import random
|
7 |
|
8 |
# Initialize the model
|
9 |
model = AutoModelForCausalLM.from_pretrained("Detsutut/Igea-1B-instruct-v0.2-GGUF", model_file="unsloth.Q4_K_M.gguf", model_type="mistral", hf=True)
|
|
|
16 |
tokenizer=tokenizer
|
17 |
)
|
18 |
|
19 |
+
system_med_msgs = ["Sei un assistente medico virtuale. Offri supporto per la gestione delle richieste mediche e fornisci informazioni mediche.",
|
20 |
+
"Sei un assistente medico virtuale. Offri supporto per questioni mediche.",
|
21 |
+
"Sei un assistente virtuale sanitario. Offri supporto e informazioni su problemi di salute.",
|
22 |
+
"Sei un assistente virtuale per la salute. Fornisci supporto per richieste riguardanti la salute.",
|
23 |
+
"Sei un assistente digitale per la salute. Fornisci supporto su questioni mediche e sanitarie.",
|
24 |
+
"Sei un assistente virtuale per informazioni sanitarie. Fornisci supporto su problemi di salute e benessere.",
|
25 |
+
"Sei un assistente digitale per la gestione delle questioni sanitarie. Rispondi a richieste mediche e fornisci informazioni sanitarie.",
|
26 |
+
"Sei un assistente sanitario digitale. Rispondi a richieste di natura medica e fornisci informazioni sanitarie.",
|
27 |
+
"Sei un assistente sanitario virtuale. Aiuti a rispondere a richieste mediche e fornisci informazioni sanitarie."]
|
28 |
+
|
29 |
alpaca_instruct_prompt = """{}
|
30 |
|
31 |
### Istruzione:
|
|
|
40 |
if len(system_prompt)>0:
|
41 |
system_str = system_prompt
|
42 |
else:
|
43 |
+
system_str = random.choice(system_med_msgs)
|
44 |
|
45 |
prompt = alpaca_instruct_prompt.format(system_str, input_text,"")
|
46 |
|