Quentin GALLOUÉDEC commited on
Commit
0625494
·
1 Parent(s): bcba9c0

show loading model only when loading

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -16,11 +16,12 @@ default_model_name = "gia-project/gia2-small-untrained"
16
 
17
 
18
  def generate_text(model_name, input_text):
19
- # Inform the user that the model is loading
20
- yield "Loading model..."
21
 
22
  # Check if the selected model is already loaded
23
  if model_name not in model_pipelines:
 
 
24
  # Load the model and create a pipeline if it's not already loaded
25
  generator = pipeline("text-generation", model=model_name, trust_remote_code=True)
26
  model_pipelines[model_name] = generator
 
16
 
17
 
18
  def generate_text(model_name, input_text):
19
+
 
20
 
21
  # Check if the selected model is already loaded
22
  if model_name not in model_pipelines:
23
+ # Inform the user that the model is loading
24
+ yield "Loading model..."
25
  # Load the model and create a pipeline if it's not already loaded
26
  generator = pipeline("text-generation", model=model_name, trust_remote_code=True)
27
  model_pipelines[model_name] = generator