Spaces:
Runtime error
Runtime error
Marina Pliusnina
commited on
Commit
·
f5848c0
1
Parent(s):
b380c20
change default parameters
Browse files
app.py
CHANGED
|
@@ -82,7 +82,7 @@ def gradio_app():
|
|
| 82 |
input_ = Textbox(
|
| 83 |
lines=11,
|
| 84 |
label="Input",
|
| 85 |
-
placeholder="
|
| 86 |
# value = "Quina és la finalitat del Servei Meteorològic de Catalunya?"
|
| 87 |
)
|
| 88 |
|
|
|
|
| 82 |
input_ = Textbox(
|
| 83 |
lines=11,
|
| 84 |
label="Input",
|
| 85 |
+
placeholder="Quina és la finalitat del Servei Meteorològic de Catalunya?",
|
| 86 |
# value = "Quina és la finalitat del Servei Meteorològic de Catalunya?"
|
| 87 |
)
|
| 88 |
|
rag.py
CHANGED
|
@@ -9,7 +9,7 @@ from langchain_community.embeddings import HuggingFaceEmbeddings
|
|
| 9 |
|
| 10 |
|
| 11 |
class RAG:
|
| 12 |
-
NO_ANSWER_MESSAGE: str = "
|
| 13 |
|
| 14 |
|
| 15 |
def __init__(self, hf_token, embeddings_model, model_name):
|
|
@@ -24,7 +24,7 @@ class RAG:
|
|
| 24 |
|
| 25 |
logging.info("RAG loaded!")
|
| 26 |
|
| 27 |
-
def get_context(self, instruction, number_of_contexts=
|
| 28 |
|
| 29 |
context = ""
|
| 30 |
|
|
@@ -54,7 +54,7 @@ class RAG:
|
|
| 54 |
|
| 55 |
payload = {
|
| 56 |
"inputs": query,
|
| 57 |
-
"parameters": {}
|
| 58 |
}
|
| 59 |
|
| 60 |
response = requests.post(self.model_name, headers=headers, json=payload)
|
|
|
|
| 9 |
|
| 10 |
|
| 11 |
class RAG:
|
| 12 |
+
NO_ANSWER_MESSAGE: str = "Ho sento, no he pogut respondre la teva pregunta."
|
| 13 |
|
| 14 |
|
| 15 |
def __init__(self, hf_token, embeddings_model, model_name):
|
|
|
|
| 24 |
|
| 25 |
logging.info("RAG loaded!")
|
| 26 |
|
| 27 |
+
def get_context(self, instruction, number_of_contexts=3):
|
| 28 |
|
| 29 |
context = ""
|
| 30 |
|
|
|
|
| 54 |
|
| 55 |
payload = {
|
| 56 |
"inputs": query,
|
| 57 |
+
"parameters": {"MAX_NEW_TOKENS": 750, "TEMPERATURE": 0.35}
|
| 58 |
}
|
| 59 |
|
| 60 |
response = requests.post(self.model_name, headers=headers, json=payload)
|