Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
@@ -15,22 +15,6 @@ 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 |
-
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 |
-
|
34 |
try:
|
35 |
start_time = time.time()
|
36 |
logger.info("Downloading Model....")
|
@@ -112,14 +96,11 @@ def respond(message, history, temperature, max_tokens):
|
|
112 |
|
113 |
end_time = time.time()
|
114 |
logger.info(f"Provider settings updated. Prompt Loaded.Time taken : {end_time - start_time} seconds.")
|
115 |
-
|
116 |
-
chunks = chunk_text(message)
|
117 |
|
118 |
start_time = time.time()
|
119 |
logger.info("Generating responses...")
|
120 |
-
|
121 |
-
|
122 |
-
chunk,
|
123 |
llm_sampling_settings=settings,
|
124 |
returns_streaming_generator = False, #generate streamer
|
125 |
print_output = False
|
|
|
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....")
|
|
|
96 |
|
97 |
end_time = time.time()
|
98 |
logger.info(f"Provider settings updated. Prompt Loaded.Time taken : {end_time - start_time} seconds.")
|
|
|
|
|
99 |
|
100 |
start_time = time.time()
|
101 |
logger.info("Generating responses...")
|
102 |
+
response = agent.get_chat_response(
|
103 |
+
message,
|
|
|
104 |
llm_sampling_settings=settings,
|
105 |
returns_streaming_generator = False, #generate streamer
|
106 |
print_output = False
|