Spaces:
Runtime error
Runtime error
portalniy-dev
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -78,6 +78,9 @@ def train_model():
|
|
78 |
def generate_text(prompt):
|
79 |
global tokenizer # Ensure we use the global tokenizer variable
|
80 |
|
|
|
|
|
|
|
81 |
input_ids = tokenizer.encode(prompt, return_tensors='pt')
|
82 |
|
83 |
# Adjust generation parameters for better quality output
|
|
|
78 |
def generate_text(prompt):
|
79 |
global tokenizer # Ensure we use the global tokenizer variable
|
80 |
|
81 |
+
if tokenizer is None:
|
82 |
+
return "Tokenizer not initialized. Please train the model first."
|
83 |
+
|
84 |
input_ids = tokenizer.encode(prompt, return_tensors='pt')
|
85 |
|
86 |
# Adjust generation parameters for better quality output
|