SumayyaAli commited on
Commit
6f9cc9b
·
verified ·
1 Parent(s): b13b93f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -9
app.py CHANGED
@@ -5,21 +5,24 @@ from transformers import T5Tokenizer, T5ForConditionalGeneration
5
  from transformers import pipeline
6
  import torch
7
  import base64
8
- import os
9
- from dotenv import load_dotenv
10
- load_dotenv()
11
- token = os.environ.get("HF_TOKEN")
12
 
13
- # Use the token for model loading or other tasks
14
- tokenizer = T5Tokenizer.from_pretrained("LaMini-Flan-T5-248M", token=token)
15
 
 
 
16
 
17
 
18
- checkpoint = "D:/project/LaMini-Flan-T5-248M"
 
 
19
  #model and tokenizer loading
20
 
21
- tokenizer = T5Tokenizer.from_pretrained(checkpoint)
22
- base_model = T5ForConditionalGeneration.from_pretrained(checkpoint, device_map='auto', torch_dtype=torch.float32, offload_folder='D:/project/offload')
23
 
24
  #file loader and preprocessing
25
  def file_preprocessing(file):
 
5
  from transformers import pipeline
6
  import torch
7
  import base64
8
+ #import os
9
+ #from dotenv import load_dotenv
10
+ from huggingface_hub import HfApi
 
11
 
12
+ api = HfApi()
13
+ token = api.get_secret("secret_token") # Replace with your secret name
14
 
15
+ #load_dotenv()
16
+ #token = os.environ.get("HF_TOKEN")
17
 
18
 
19
+
20
+
21
+ checkpoint = "LaMini-Flan-T5-248M"
22
  #model and tokenizer loading
23
 
24
+ tokenizer = T5Tokenizer.from_pretrained(checkpoint, token=token)
25
+ base_model = T5ForConditionalGeneration.from_pretrained(checkpoint, token=token, device_map='auto', torch_dtype=torch.float32, offload_folder='D:/project/offload')
26
 
27
  #file loader and preprocessing
28
  def file_preprocessing(file):