Spaces:
Runtime error
Runtime error
contenteaseAI
commited on
Commit
•
10c9e58
1
Parent(s):
32c9a11
Update app.py
Browse files
app.py
CHANGED
@@ -15,6 +15,21 @@ logger = logging.getLogger(__name__)
|
|
15 |
repo_id = "QuantFactory/Meta-Llama-3-8B-Instruct-GGUF"
|
16 |
filename = "Meta-Llama-3-8B-Instruct.Q8_0.gguf"
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
try:
|
19 |
start_time = time.time()
|
20 |
logger.info("Downloading Model....")
|
|
|
15 |
repo_id = "QuantFactory/Meta-Llama-3-8B-Instruct-GGUF"
|
16 |
filename = "Meta-Llama-3-8B-Instruct.Q8_0.gguf"
|
17 |
|
18 |
+
def chunk_text(text, chunk_size=5000):
|
19 |
+
"""
|
20 |
+
Splits the input text into chunks of specified size.
|
21 |
+
|
22 |
+
Args:
|
23 |
+
text (str): The input text to be chunked.
|
24 |
+
chunk_size (int): The size of each chunk in tokens.
|
25 |
+
|
26 |
+
Returns:
|
27 |
+
list: A list of text chunks.
|
28 |
+
"""
|
29 |
+
words = text.split()
|
30 |
+
chunks = [' '.join(words[i:i + chunk_size]) for i in range(0, len(words), chunk_size)]
|
31 |
+
return chunks
|
32 |
+
|
33 |
try:
|
34 |
start_time = time.time()
|
35 |
logger.info("Downloading Model....")
|