import gradio as gr from langchain_core.prompts import ChatPromptTemplate from langchain.chains.combine_documents import create_stuff_documents_chain from langchain.chains import create_retrieval_chain from langchain import HuggingFaceHub import os os.environ["HUGGINGFACEHUB_API_TOKEN"] = os.getenv('hf_token') llm = HuggingFaceHub(repo_id="tiiuae/falcon-7b-instruct", model_kwargs={"max_length": 300, "max_new_tokens": 300}) def echo(message, history): message = llm.invoke(message) return message demo = gr.ChatInterface(fn=echo, examples=["hello", "hola", "merhaba"], title="Echo Bot") demo.launch()