Update app.py
Browse files
app.py
CHANGED
|
@@ -105,7 +105,7 @@ def convert_sbml_to_antimony(sbml_file_path, antimony_file_path):
|
|
| 105 |
def split_biomodels(antimony_file_path):
|
| 106 |
|
| 107 |
text_splitter = RecursiveCharacterTextSplitter(
|
| 108 |
-
chunk_size=
|
| 109 |
chunk_overlap=20,
|
| 110 |
length_function=len,
|
| 111 |
is_separator_regex=False,
|
|
@@ -148,8 +148,9 @@ def create_vector_db(final_items):
|
|
| 148 |
from llama_cpp import Llama
|
| 149 |
|
| 150 |
llm = Llama.from_pretrained(
|
| 151 |
-
repo_id="
|
| 152 |
-
filename="
|
|
|
|
| 153 |
)
|
| 154 |
|
| 155 |
for item in final_items:
|
|
@@ -165,13 +166,12 @@ def create_vector_db(final_items):
|
|
| 165 |
Once the summarizing is done, write 'END'.
|
| 166 |
"""
|
| 167 |
|
| 168 |
-
response2 =
|
|
|
|
|
|
|
|
|
|
| 169 |
|
| 170 |
-
|
| 171 |
-
response = response2[0]["text"].strip()
|
| 172 |
-
documents.append(response)
|
| 173 |
-
else:
|
| 174 |
-
print("No response received from Llama model.")
|
| 175 |
|
| 176 |
if final_items:
|
| 177 |
db.add(
|
|
@@ -196,8 +196,9 @@ def generate_response(db, query_text, previous_context):
|
|
| 196 |
from llama_cpp import Llama
|
| 197 |
|
| 198 |
llm = Llama.from_pretrained(
|
| 199 |
-
repo_id="
|
| 200 |
-
filename="
|
|
|
|
| 201 |
)
|
| 202 |
|
| 203 |
prompt_template = f"""
|
|
@@ -220,9 +221,7 @@ def generate_response(db, query_text, previous_context):
|
|
| 220 |
prompt_template
|
| 221 |
)
|
| 222 |
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
print(response)
|
| 226 |
|
| 227 |
|
| 228 |
def streamlit_app():
|
|
|
|
| 105 |
def split_biomodels(antimony_file_path):
|
| 106 |
|
| 107 |
text_splitter = RecursiveCharacterTextSplitter(
|
| 108 |
+
chunk_size=2000,
|
| 109 |
chunk_overlap=20,
|
| 110 |
length_function=len,
|
| 111 |
is_separator_regex=False,
|
|
|
|
| 148 |
from llama_cpp import Llama
|
| 149 |
|
| 150 |
llm = Llama.from_pretrained(
|
| 151 |
+
repo_id="google/gemma-2-2b-it-GGUF",
|
| 152 |
+
filename="2b_it_v2.gguf",
|
| 153 |
+
verbose = True
|
| 154 |
)
|
| 155 |
|
| 156 |
for item in final_items:
|
|
|
|
| 166 |
Once the summarizing is done, write 'END'.
|
| 167 |
"""
|
| 168 |
|
| 169 |
+
response2 = llm(
|
| 170 |
+
prompt,
|
| 171 |
+
max_tokens = None,
|
| 172 |
+
)
|
| 173 |
|
| 174 |
+
print(response2)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 175 |
|
| 176 |
if final_items:
|
| 177 |
db.add(
|
|
|
|
| 196 |
from llama_cpp import Llama
|
| 197 |
|
| 198 |
llm = Llama.from_pretrained(
|
| 199 |
+
repo_id="google/gemma-2-2b-it-GGUF",
|
| 200 |
+
filename="2b_it_v2.gguf",
|
| 201 |
+
verbose = True
|
| 202 |
)
|
| 203 |
|
| 204 |
prompt_template = f"""
|
|
|
|
| 221 |
prompt_template
|
| 222 |
)
|
| 223 |
|
| 224 |
+
print(response2)
|
|
|
|
|
|
|
| 225 |
|
| 226 |
|
| 227 |
def streamlit_app():
|