Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
5612036
1
Parent(s):
c9b5c5a
update
Browse files
app.py
CHANGED
|
@@ -125,7 +125,7 @@ def initialize_model_and_attr():
|
|
| 125 |
return None, None, error_msg
|
| 126 |
|
| 127 |
# Remove immediate initialization - let lazy initialization work
|
| 128 |
-
|
| 129 |
|
| 130 |
# Images replaced with CSS textures and gradients - no longer needed
|
| 131 |
|
|
@@ -209,7 +209,7 @@ def generate_model_response(state: State):
|
|
| 209 |
|
| 210 |
# Initialize model and attribution with default configuration
|
| 211 |
print(f"🔧 Generating response with explanation_level: {DEFAULT_EXPLANATION_LEVEL}")
|
| 212 |
-
llm, attr, error_msg = initialize_model_and_attr()
|
| 213 |
|
| 214 |
if llm is None or attr is None:
|
| 215 |
error_text = error_msg if error_msg else "Model initialization failed!"
|
|
@@ -235,8 +235,8 @@ def split_into_sentences(text: str):
|
|
| 235 |
lines = text.splitlines()
|
| 236 |
sentences = []
|
| 237 |
for line in lines:
|
| 238 |
-
sentences.extend(sent_tokenize(line))
|
| 239 |
-
|
| 240 |
separators = []
|
| 241 |
cur_start = 0
|
| 242 |
for sentence in sentences:
|
|
@@ -326,7 +326,7 @@ def unified_response_handler(response_text: str, state: State):
|
|
| 326 |
)
|
| 327 |
|
| 328 |
# Initialize model and generate response
|
| 329 |
-
llm, attr, error_msg = initialize_model_and_attr()
|
| 330 |
|
| 331 |
if llm is None:
|
| 332 |
error_text = error_msg if error_msg else "Model initialization failed!"
|
|
@@ -424,7 +424,7 @@ def basic_get_scores_and_sources_full_response(state: State):
|
|
| 424 |
state.explained_response_part = state.full_response
|
| 425 |
|
| 426 |
# Attribution using default configuration
|
| 427 |
-
_, attr, error_msg = initialize_model_and_attr()
|
| 428 |
|
| 429 |
if attr is None:
|
| 430 |
error_text = error_msg if error_msg else "Traceback initialization failed!"
|
|
@@ -639,7 +639,7 @@ def basic_get_scores_and_sources(
|
|
| 639 |
state.explained_response_part = selected_text
|
| 640 |
|
| 641 |
# Attribution using default configuration
|
| 642 |
-
_, attr, error_msg = initialize_model_and_attr()
|
| 643 |
|
| 644 |
if attr is None:
|
| 645 |
error_text = error_msg if error_msg else "Traceback initialization failed!"
|
|
|
|
| 125 |
return None, None, error_msg
|
| 126 |
|
| 127 |
# Remove immediate initialization - let lazy initialization work
|
| 128 |
+
llm, attr, error_msg = initialize_model_and_attr() # Commented out to avoid main-thread CUDA initialization
|
| 129 |
|
| 130 |
# Images replaced with CSS textures and gradients - no longer needed
|
| 131 |
|
|
|
|
| 209 |
|
| 210 |
# Initialize model and attribution with default configuration
|
| 211 |
print(f"🔧 Generating response with explanation_level: {DEFAULT_EXPLANATION_LEVEL}")
|
| 212 |
+
#llm, attr, error_msg = initialize_model_and_attr()
|
| 213 |
|
| 214 |
if llm is None or attr is None:
|
| 215 |
error_text = error_msg if error_msg else "Model initialization failed!"
|
|
|
|
| 235 |
lines = text.splitlines()
|
| 236 |
sentences = []
|
| 237 |
for line in lines:
|
| 238 |
+
#sentences.extend(sent_tokenize(line))
|
| 239 |
+
sentences.extend(line.split("."))
|
| 240 |
separators = []
|
| 241 |
cur_start = 0
|
| 242 |
for sentence in sentences:
|
|
|
|
| 326 |
)
|
| 327 |
|
| 328 |
# Initialize model and generate response
|
| 329 |
+
#llm, attr, error_msg = initialize_model_and_attr()
|
| 330 |
|
| 331 |
if llm is None:
|
| 332 |
error_text = error_msg if error_msg else "Model initialization failed!"
|
|
|
|
| 424 |
state.explained_response_part = state.full_response
|
| 425 |
|
| 426 |
# Attribution using default configuration
|
| 427 |
+
#_, attr, error_msg = initialize_model_and_attr()
|
| 428 |
|
| 429 |
if attr is None:
|
| 430 |
error_text = error_msg if error_msg else "Traceback initialization failed!"
|
|
|
|
| 639 |
state.explained_response_part = selected_text
|
| 640 |
|
| 641 |
# Attribution using default configuration
|
| 642 |
+
#_, attr, error_msg = initialize_model_and_attr()
|
| 643 |
|
| 644 |
if attr is None:
|
| 645 |
error_text = error_msg if error_msg else "Traceback initialization failed!"
|