portalniy-dev commited on
Commit
825d871
Β·
verified Β·
1 Parent(s): 742077b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -0
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