from huggingface_hub import HfFileSystem fs = HfFileSystem() from langchain import HuggingFaceHub from langchain import SQLDatabase from langchain_experimental.sql.base import SQLDatabaseSequentialChain from langchain_experimental.sql import SQLDatabaseChain import json import os overal_temperature = 0.2 os.environ["HUGGINGFACEHUB_API_TOKEN"] = "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" llm = HuggingFaceHub(repo_id="juierror/flan-t5-text2sql-with-schema-v2", model_kwargs={"temperature":overal_temperature, "max_new_tokens":200} ) sqlite_db_path = "hf://datasets/ankit75100/Ankit/test_db.db" db1 = SQLDatabase.from_uri(f"sqlite:///{sqlite_db_path}") include_tables=['Employee','Album','Artist','Customer'], db_chain = SQLDatabaseChain.from_llm(llm, db1, verbose=True, return_direct=True) #user_input = input("Enter something: ") #datbase=db_chain.run(user_input) #print(datbase) def process_input(input_text): Result=db_chain.run(input_text) return Result