5.3 KiB
5.3 KiB
In [ ]:
!pip install embedchainIn [ ]:
!pip install embedchain[huggingface-hub]In [ ]:
!pip install embedchain[opensource]In [ ]:
import os
from embedchain import App
os.environ["HUGGINGFACE_ACCESS_TOKEN"] = "hf_xxx"In [ ]:
config = """
llm:
provider: huggingface
config:
model: 'google/flan-t5-xxl'
temperature: 0.5
max_tokens: 1000
top_p: 0.8
stream: false
embedder:
provider: huggingface
config:
model: 'sentence-transformers/all-mpnet-base-v2'
"""
# Write the multi-line string to a YAML file
with open('huggingface.yaml', 'w') as file:
file.write(config)In [ ]:
app = App.from_config(yaml_path="huggingface.yaml")In [ ]:
app.add("https://www.forbes.com/profile/elon-musk")In [ ]:
while(True):
question = input("Enter question: ")
if question in ['q', 'exit', 'quit']:
break
answer = app.query(question)
print(answer)In [ ]: