Spaces:
Runtime error
Runtime error
Commit
·
a7cdd19
1
Parent(s):
113c0ca
Update components/custom_llm.py
Browse files- components/custom_llm.py +2 -1
components/custom_llm.py
CHANGED
@@ -6,7 +6,7 @@ from typing import Literal
|
|
6 |
import requests
|
7 |
from langchain.prompts import PromptTemplate, ChatPromptTemplate
|
8 |
from operator import itemgetter
|
9 |
-
import re
|
10 |
|
11 |
|
12 |
def format_captions(text):
|
@@ -15,6 +15,7 @@ def format_captions(text):
|
|
15 |
return "\n".join([f"{i+1}. {d}" for i,d in enumerate(sentences)])
|
16 |
|
17 |
def custom_chain():
|
|
|
18 |
|
19 |
prompt = PromptTemplate.from_template("<s><INST>Given the below template, create a list of image generation prompt with maximum 5 words for each number\n\n{template}<INST> ")
|
20 |
|
|
|
6 |
import requests
|
7 |
from langchain.prompts import PromptTemplate, ChatPromptTemplate
|
8 |
from operator import itemgetter
|
9 |
+
import re, os
|
10 |
|
11 |
|
12 |
def format_captions(text):
|
|
|
15 |
return "\n".join([f"{i+1}. {d}" for i,d in enumerate(sentences)])
|
16 |
|
17 |
def custom_chain():
|
18 |
+
API_TOKEN = os.environ['HF_INFER_API']
|
19 |
|
20 |
prompt = PromptTemplate.from_template("<s><INST>Given the below template, create a list of image generation prompt with maximum 5 words for each number\n\n{template}<INST> ")
|
21 |
|