Spaces:
Sleeping
Sleeping
Commit
·
1e9ebc3
1
Parent(s):
62ea137
feat: add langchain demo
Browse files- langchain_dev.py +15 -0
- requirements.txt +3 -1
langchain_dev.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from langchain_huggingface import HuggingFaceEndpoint
|
2 |
+
|
3 |
+
import env_config
|
4 |
+
|
5 |
+
hf_api_token = env_config.HF_API_TOKEN
|
6 |
+
|
7 |
+
|
8 |
+
llm = HuggingFaceEndpoint(
|
9 |
+
repo_id='tiiuae/falcon-7b-instruct',
|
10 |
+
huggingfacehub_api_token=hf_api_token
|
11 |
+
)
|
12 |
+
|
13 |
+
question = 'Can you still have fun'
|
14 |
+
output = llm.invoke(question)
|
15 |
+
print(output)
|
requirements.txt
CHANGED
@@ -1,3 +1,5 @@
|
|
1 |
transformers==4.36.0
|
2 |
sentencepiece
|
3 |
-
accelerate
|
|
|
|
|
|
1 |
transformers==4.36.0
|
2 |
sentencepiece
|
3 |
+
accelerate
|
4 |
+
langchain==0.3.14
|
5 |
+
langchain-huggingface==0.1.2
|