Amitontheweb commited on
Commit
afcda5f
1 Parent(s): 7c242ca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -4,7 +4,9 @@
4
  from transformers import AutoModelForCausalLM, AutoTokenizer
5
  import torch
6
  import gradio as gr
 
7
 
 
8
 
9
  # Load default model as GPT2 and other models
10
 
@@ -16,7 +18,7 @@ tokenizer_gpt2 = AutoTokenizer.from_pretrained("openai-community/gpt2")
16
  model_gpt2 = AutoModelForCausalLM.from_pretrained("openai-community/gpt2")
17
 
18
  tokenizer_gemma = AutoTokenizer.from_pretrained("google/gemma-2b")
19
- model_gemma = AutoModelForCausalLM.from_pretrained("google/gemma-2b")
20
 
21
  tokenizer_Mistral = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-v0.1")
22
  model_Mistral = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-v0.1")
 
4
  from transformers import AutoModelForCausalLM, AutoTokenizer
5
  import torch
6
  import gradio as gr
7
+ import os
8
 
9
+ token = os.environ.get("HF_TOKEN")
10
 
11
  # Load default model as GPT2 and other models
12
 
 
18
  model_gpt2 = AutoModelForCausalLM.from_pretrained("openai-community/gpt2")
19
 
20
  tokenizer_gemma = AutoTokenizer.from_pretrained("google/gemma-2b")
21
+ model_gemma = AutoModelForCausalLM.from_pretrained("google/gemma-2b", token=token)
22
 
23
  tokenizer_Mistral = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-v0.1")
24
  model_Mistral = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-v0.1")