pokeberrypie commited on
Commit
1664900
·
verified ·
1 Parent(s): b3b72cf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -13
app.py CHANGED
@@ -2,21 +2,9 @@
2
  import os
3
  import gradio as gr
4
  from transformers import pipeline
5
-
6
- # Load the API key from environment variables
7
- api_key = os.getenv("HF_API_KEY")
8
-
9
- if api_key is None:
10
- print("HF_API_KEY not found. Please set it in the Space's secrets.")
11
- else:
12
- # Set the necessary environment variables for Hugging Face Transformers
13
- os.environ["HF_HOME"] = "/workspace" # Use the /workspace directory in Hugging Face Spaces
14
- os.environ["TRANSFORMERS_CACHE"] = "/workspace/cache" # Cache directory in Space
15
- os.environ["HF_API_KEY"] = api_key # Set the API key for Transformers library
16
-
17
  # Initialize the model using the API key and Transformers pipeline
18
  try:
19
- model_name = "tiiuae/falcon-180B" # Ensure this is the correct model name
20
  nlp_model = pipeline('text-generation', model=model_name)
21
  print("Model loaded successfully.")
22
  except Exception as e:
 
2
  import os
3
  import gradio as gr
4
  from transformers import pipeline
 
 
 
 
 
 
 
 
 
 
 
 
5
  # Initialize the model using the API key and Transformers pipeline
6
  try:
7
+ model_name = "tiiuae/falcon-40b-instruct" # Ensure this is the correct model name
8
  nlp_model = pipeline('text-generation', model=model_name)
9
  print("Model loaded successfully.")
10
  except Exception as e: