Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -18,6 +18,17 @@ model_version = "v1687507574"
|
|
18 |
model_repo_id = "chansung/kerasnlp-gpt2-alpaca-pipeline"
|
19 |
model_repo_url = f"https://huggingface.co/{model_repo_id}"
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
STYLE = """
|
22 |
.custom-btn {
|
23 |
border: none !important;
|
@@ -231,17 +242,6 @@ examples = [
|
|
231 |
]
|
232 |
ex_btns = []
|
233 |
|
234 |
-
def _clone_and_checkout(repo_url: str, local_path: str, version: str) -> Repository:
|
235 |
-
repository = Repository(
|
236 |
-
local_dir=local_path, clone_from=repo_url
|
237 |
-
)
|
238 |
-
repository.git_checkout(revision=version)
|
239 |
-
return repository
|
240 |
-
|
241 |
-
_ = _clone_and_checkout(model_repo_url, local_path, model_version)
|
242 |
-
model = tf.saved_model.load(local_path, tags=[tag_constants.SERVING])
|
243 |
-
gpt_lm_predict_fn = model.signatures["serving_default"]
|
244 |
-
|
245 |
def build_prompts(ppmanager, user_message, win_size=3):
|
246 |
dummy_ppm = copy.deepcopy(ppmanager)
|
247 |
|
|
|
18 |
model_repo_id = "chansung/kerasnlp-gpt2-alpaca-pipeline"
|
19 |
model_repo_url = f"https://huggingface.co/{model_repo_id}"
|
20 |
|
21 |
+
def _clone_and_checkout(repo_url: str, local_path: str, version: str) -> Repository:
|
22 |
+
repository = Repository(
|
23 |
+
local_dir=local_path, clone_from=repo_url
|
24 |
+
)
|
25 |
+
repository.git_checkout(revision=version)
|
26 |
+
return repository
|
27 |
+
|
28 |
+
_ = _clone_and_checkout(model_repo_url, local_path, model_version)
|
29 |
+
model = tf.saved_model.load(local_path, tags=[tag_constants.SERVING])
|
30 |
+
gpt_lm_predict_fn = model.signatures["serving_default"]
|
31 |
+
|
32 |
STYLE = """
|
33 |
.custom-btn {
|
34 |
border: none !important;
|
|
|
242 |
]
|
243 |
ex_btns = []
|
244 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
def build_prompts(ppmanager, user_message, win_size=3):
|
246 |
dummy_ppm = copy.deepcopy(ppmanager)
|
247 |
|