Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1430,14 +1430,14 @@ def run_chatbot(n_clicks, n_submit, user_input, chat_history, array_value):
|
|
1430 |
|
1431 |
os.environ['HUGGINGFACEHUB_API_TOKEN'] = os.environ['HUGGINGFACEHUB_API_TOKEN']
|
1432 |
#repo_id = "mistralai/Mistral-7B-Instruct-v0.3"
|
1433 |
-
repo_id = "mistralai/
|
1434 |
#repo_id = "microsoft/Phi-3.5-mini-instruct"
|
1435 |
#mistral_url = "https://api-inference.huggingface.co/models/mistralai/Mixtral-8x22B-Instruct-v0.1"
|
1436 |
llm = HuggingFaceEndpoint(
|
1437 |
repo_id=repo_id, task="text2text-generation", max_new_tokens=8000, temperature=0.3, streaming=True
|
1438 |
)
|
1439 |
model_output = ""
|
1440 |
-
chain = prompt | llm
|
1441 |
for s in chain.stream({"question":"D'après le contexte, " + user_input,"context":context_p}):
|
1442 |
model_output = model_output + s
|
1443 |
print(s, end="", flush=True)
|
|
|
1430 |
|
1431 |
os.environ['HUGGINGFACEHUB_API_TOKEN'] = os.environ['HUGGINGFACEHUB_API_TOKEN']
|
1432 |
#repo_id = "mistralai/Mistral-7B-Instruct-v0.3"
|
1433 |
+
repo_id = "mistralai/Mistral-7B-Instruct-v0.2"
|
1434 |
#repo_id = "microsoft/Phi-3.5-mini-instruct"
|
1435 |
#mistral_url = "https://api-inference.huggingface.co/models/mistralai/Mixtral-8x22B-Instruct-v0.1"
|
1436 |
llm = HuggingFaceEndpoint(
|
1437 |
repo_id=repo_id, task="text2text-generation", max_new_tokens=8000, temperature=0.3, streaming=True
|
1438 |
)
|
1439 |
model_output = ""
|
1440 |
+
chain = prompt | llm | StrOutputParser()
|
1441 |
for s in chain.stream({"question":"D'après le contexte, " + user_input,"context":context_p}):
|
1442 |
model_output = model_output + s
|
1443 |
print(s, end="", flush=True)
|