pokeberrypie commited on
Commit
4be8187
1 Parent(s): d896de4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -1,8 +1,11 @@
1
  import gradio as gr
2
- from transformers import pipeline
3
 
4
- # Load the model once when the script starts
5
- generator = pipeline('text-generation', model='tiiuae/falcon-40b-instruct', trust_remote_code=True)
 
 
 
6
 
7
  def generate_text(prompt):
8
  # Use the preloaded model
 
1
  import gradio as gr
2
+ from transformers import pipeline, AutoConfig
3
 
4
+ # Explicitly load the configuration with trust_remote_code
5
+ config = AutoConfig.from_pretrained('tiiuae/falcon-40b-instruct', trust_remote_code=True)
6
+
7
+ # Load the model once when the script starts using the loaded config
8
+ generator = pipeline('text-generation', model='tiiuae/falcon-40b-instruct', config=config)
9
 
10
  def generate_text(prompt):
11
  # Use the preloaded model