Spaces:
Sleeping
Sleeping
Anwar11234
commited on
Commit
•
cf13d8d
1
Parent(s):
33a1b48
removed login code from app.py
Browse files
app.py
CHANGED
@@ -3,12 +3,6 @@ from typing import Dict
|
|
3 |
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
|
4 |
from peft import PeftModel, PeftConfig
|
5 |
from fastapi.middleware.cors import CORSMiddleware
|
6 |
-
import os
|
7 |
-
from huggingface_hub import HfApi
|
8 |
-
|
9 |
-
hf_api = HfApi() # Create a Hugging Face API client
|
10 |
-
access_token = os.environ.get("HF_TOKEN")
|
11 |
-
hf_api.set_access_token(access_token)
|
12 |
|
13 |
app = FastAPI()
|
14 |
|
@@ -22,7 +16,7 @@ app.add_middleware(
|
|
22 |
|
23 |
def load_model():
|
24 |
peft_model_id = "ANWAR101/lora-bart-base-youtube-cnn"
|
25 |
-
config = PeftConfig.from_pretrained(peft_model_id
|
26 |
model = AutoModelForSeq2SeqLM.from_pretrained(config.base_model_name_or_path)
|
27 |
tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
|
28 |
model = PeftModel.from_pretrained(model, peft_model_id)
|
|
|
3 |
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
|
4 |
from peft import PeftModel, PeftConfig
|
5 |
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
app = FastAPI()
|
8 |
|
|
|
16 |
|
17 |
def load_model():
|
18 |
peft_model_id = "ANWAR101/lora-bart-base-youtube-cnn"
|
19 |
+
config = PeftConfig.from_pretrained(peft_model_id)
|
20 |
model = AutoModelForSeq2SeqLM.from_pretrained(config.base_model_name_or_path)
|
21 |
tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
|
22 |
model = PeftModel.from_pretrained(model, peft_model_id)
|