Spaces:
Sleeping
Sleeping
VasithaTilakumara commited on
Commit ·
a0621a0
1
Parent(s): daeacc1
change local llm to huggingface inference API
Browse files- requirements.txt +6 -7
- tabs/business.py +1 -1
- tabs/shared_ai.py +2 -2
requirements.txt
CHANGED
|
@@ -16,15 +16,14 @@ seaborn
|
|
| 16 |
matplotlib
|
| 17 |
|
| 18 |
# Hugging Face model integration
|
| 19 |
-
|
|
|
|
|
|
|
| 20 |
|
| 21 |
# LangChain (for AI chat and LLM integration)
|
| 22 |
-
langchain
|
| 23 |
-
langchain-community
|
| 24 |
-
|
| 25 |
langchain==1.0.2
|
| 26 |
langchain-community
|
| 27 |
-
|
| 28 |
-
transformers>=4.30.0
|
| 29 |
accelerate
|
| 30 |
-
safetensors
|
|
|
|
|
|
| 16 |
matplotlib
|
| 17 |
|
| 18 |
# Hugging Face model integration
|
| 19 |
+
langchain-huggingface>=0.0.2
|
| 20 |
+
huggingface-hub>=0.19.0
|
| 21 |
+
transformers>=4.30.0
|
| 22 |
|
| 23 |
# LangChain (for AI chat and LLM integration)
|
|
|
|
|
|
|
|
|
|
| 24 |
langchain==1.0.2
|
| 25 |
langchain-community
|
| 26 |
+
|
|
|
|
| 27 |
accelerate
|
| 28 |
+
safetensors
|
| 29 |
+
|
tabs/business.py
CHANGED
|
@@ -104,6 +104,6 @@ def render():
|
|
| 104 |
gr.HTML("<h3> Scenario Chat : What-If Analysis</h3>")
|
| 105 |
respond,title = ai_chat_factory("Business Insights & What-If Analysis")
|
| 106 |
# gr.ChatInterface(fn=respond, chatbot=gr.Chatbot(label=title,height=290))
|
| 107 |
-
gr.ChatInterface(fn=respond, chatbot=gr.Chatbot(type="messages",height=250))
|
| 108 |
|
| 109 |
# gr.HTML(f"<style>{css}</style>")
|
|
|
|
| 104 |
gr.HTML("<h3> Scenario Chat : What-If Analysis</h3>")
|
| 105 |
respond,title = ai_chat_factory("Business Insights & What-If Analysis")
|
| 106 |
# gr.ChatInterface(fn=respond, chatbot=gr.Chatbot(label=title,height=290))
|
| 107 |
+
gr.ChatInterface(fn=respond, type="messages", chatbot=gr.Chatbot(type="messages",height=250))
|
| 108 |
|
| 109 |
# gr.HTML(f"<style>{css}</style>")
|
tabs/shared_ai.py
CHANGED
|
@@ -17,7 +17,7 @@ from pydantic import BaseModel, ValidationError
|
|
| 17 |
|
| 18 |
# LangChain components
|
| 19 |
from langchain_community.chat_models import ChatOllama, ChatHuggingFace
|
| 20 |
-
from langchain_community.llms import HuggingFaceHub
|
| 21 |
|
| 22 |
from langchain_community.chat_models import ChatOllama
|
| 23 |
from langchain_huggingface import ChatHuggingFace, HuggingFaceEndpoint
|
|
@@ -61,7 +61,7 @@ def get_llm():
|
|
| 61 |
return None
|
| 62 |
try:
|
| 63 |
llm = ChatHuggingFace(
|
| 64 |
-
llm=
|
| 65 |
repo_id="mistralai/Mistral-7B-Instruct-v0.2",
|
| 66 |
huggingfacehub_api_token=HF_TOKEN,
|
| 67 |
model_kwargs={"temperature": 0.3, "max_new_tokens": 512}
|
|
|
|
| 17 |
|
| 18 |
# LangChain components
|
| 19 |
from langchain_community.chat_models import ChatOllama, ChatHuggingFace
|
| 20 |
+
# from langchain_community.llms import HuggingFaceHub
|
| 21 |
|
| 22 |
from langchain_community.chat_models import ChatOllama
|
| 23 |
from langchain_huggingface import ChatHuggingFace, HuggingFaceEndpoint
|
|
|
|
| 61 |
return None
|
| 62 |
try:
|
| 63 |
llm = ChatHuggingFace(
|
| 64 |
+
llm=HuggingFaceEndpoint(
|
| 65 |
repo_id="mistralai/Mistral-7B-Instruct-v0.2",
|
| 66 |
huggingfacehub_api_token=HF_TOKEN,
|
| 67 |
model_kwargs={"temperature": 0.3, "max_new_tokens": 512}
|