Commit ·
45f31ac
1
Parent(s): 0dfad91
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,9 +13,6 @@ from llama_cpp import Llama
|
|
| 13 |
from huggingface_hub import login
|
| 14 |
login(token = os.getenv('HF_TOKEN'))
|
| 15 |
|
| 16 |
-
# subprocess.run('pip install llama-cpp-python==0.2.75 --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cu124', shell=True)
|
| 17 |
-
# subprocess.run('pip install llama-cpp-agent==0.2.10', shell=True)
|
| 18 |
-
|
| 19 |
repo_id = "srijaydeshpande/Deid-Fine-Tuned"
|
| 20 |
model_id = "deid_finetuned.Q4_K_M.gguf"
|
| 21 |
|
|
@@ -26,18 +23,6 @@ hf_hub_download(
|
|
| 26 |
local_dir = "./models"
|
| 27 |
)
|
| 28 |
|
| 29 |
-
# hf_hub_download(
|
| 30 |
-
# repo_id="QuantFactory/Meta-Llama-3-8B-Instruct-GGUF",
|
| 31 |
-
# filename="Meta-Llama-3-8B-Instruct.Q8_0.gguf",
|
| 32 |
-
# local_dir = "./models"
|
| 33 |
-
# )
|
| 34 |
-
|
| 35 |
-
# hf_hub_download(
|
| 36 |
-
# repo_id="bartowski/Meta-Llama-3-70B-Instruct-GGUF",
|
| 37 |
-
# filename="Meta-Llama-3-70B-Instruct-Q3_K_M.gguf",
|
| 38 |
-
# local_dir = "./models"
|
| 39 |
-
# )
|
| 40 |
-
|
| 41 |
def process_document(pdf_path):
|
| 42 |
extracted_pages = extract_pages(pdf_path)
|
| 43 |
page2content = {}
|
|
@@ -139,15 +124,12 @@ def deidentify_doc(llm_type, pdftext, maxtokens, temperature, top_probability):
|
|
| 139 |
|
| 140 |
else:
|
| 141 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
| 142 |
-
messages = [{"role": "assistant", "content":
|
| 143 |
-
|
| 144 |
-
messages.append({"role": "user", "content": "How are you doing?"})
|
| 145 |
response = ""
|
| 146 |
-
print('PROMPT IS ',messages)
|
| 147 |
for message in client.chat_completion(
|
| 148 |
messages,
|
| 149 |
max_tokens=max_tokens,
|
| 150 |
-
# stream=True,
|
| 151 |
temperature=temperature,
|
| 152 |
top_p=top_probability,
|
| 153 |
):
|
|
|
|
| 13 |
from huggingface_hub import login
|
| 14 |
login(token = os.getenv('HF_TOKEN'))
|
| 15 |
|
|
|
|
|
|
|
|
|
|
| 16 |
repo_id = "srijaydeshpande/Deid-Fine-Tuned"
|
| 17 |
model_id = "deid_finetuned.Q4_K_M.gguf"
|
| 18 |
|
|
|
|
| 23 |
local_dir = "./models"
|
| 24 |
)
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
def process_document(pdf_path):
|
| 27 |
extracted_pages = extract_pages(pdf_path)
|
| 28 |
page2content = {}
|
|
|
|
| 124 |
|
| 125 |
else:
|
| 126 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
| 127 |
+
messages = [{"role": "assistant", "content": prompt}]
|
| 128 |
+
messages.append({"role": "user", "content": pdftext})
|
|
|
|
| 129 |
response = ""
|
|
|
|
| 130 |
for message in client.chat_completion(
|
| 131 |
messages,
|
| 132 |
max_tokens=max_tokens,
|
|
|
|
| 133 |
temperature=temperature,
|
| 134 |
top_p=top_probability,
|
| 135 |
):
|