Spaces:
Running
Running
Commit
·
6c8ff63
1
Parent(s):
a7f8412
fixed not added access token
Browse files
app.py
CHANGED
@@ -24,8 +24,12 @@ if not NEWSAPI_KEY or not access_token:
|
|
24 |
raise ValueError("NEWSAPI_KEY or API_KEY not found in .env file.")
|
25 |
|
26 |
# Initialize the model and tokenizer for the HuggingFace pipeline
|
27 |
-
tokenizer = AutoTokenizer.from_pretrained("google/gemma-2b-it")
|
28 |
-
model = AutoModelForCausalLM.from_pretrained(
|
|
|
|
|
|
|
|
|
29 |
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer, max_new_tokens=512)
|
30 |
|
31 |
# Define functions for fetching stock data, news, and moving averages
|
|
|
24 |
raise ValueError("NEWSAPI_KEY or API_KEY not found in .env file.")
|
25 |
|
26 |
# Initialize the model and tokenizer for the HuggingFace pipeline
|
27 |
+
tokenizer = AutoTokenizer.from_pretrained("google/gemma-2b-it", token=access_token)
|
28 |
+
model = AutoModelForCausalLM.from_pretrained(
|
29 |
+
"google/gemma-2b-it",
|
30 |
+
torch_dtype=torch.bfloat16,
|
31 |
+
token=access_token
|
32 |
+
)
|
33 |
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer, max_new_tokens=512)
|
34 |
|
35 |
# Define functions for fetching stock data, news, and moving averages
|