Spaces:
Running
Running
Update utils.py
Browse files
utils.py
CHANGED
|
@@ -3,6 +3,7 @@ import re
|
|
| 3 |
import json
|
| 4 |
import torch
|
| 5 |
import gradio as gr
|
|
|
|
| 6 |
from peft import get_peft_model, LoraConfig
|
| 7 |
from huggingface_hub import hf_hub_download
|
| 8 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
|
@@ -16,7 +17,7 @@ def load_paper_text(text_path):
|
|
| 16 |
with open(text_path, 'r', encoding='utf-8') as f:
|
| 17 |
return f.read()
|
| 18 |
|
| 19 |
-
@
|
| 20 |
def load_model():
|
| 21 |
pt_path = hf_hub_download(
|
| 22 |
repo_id="strarr/reddit-sumarize-model",
|
|
|
|
| 3 |
import json
|
| 4 |
import torch
|
| 5 |
import gradio as gr
|
| 6 |
+
import functools
|
| 7 |
from peft import get_peft_model, LoraConfig
|
| 8 |
from huggingface_hub import hf_hub_download
|
| 9 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
|
|
|
| 17 |
with open(text_path, 'r', encoding='utf-8') as f:
|
| 18 |
return f.read()
|
| 19 |
|
| 20 |
+
@functools.lru_cache(maxsize=1)
|
| 21 |
def load_model():
|
| 22 |
pt_path = hf_hub_download(
|
| 23 |
repo_id="strarr/reddit-sumarize-model",
|