File size: 1,281 Bytes
f8b0fab
 
 
 
 
 
 
 
db8344b
c95736b
 
f8b0fab
 
 
 
 
 
 
 
 
0f27ac5
f8b0fab
23496d5
0419f76
22c6298
 
0f9e25e
0f27ac5
 
0419f76
0f9e25e
22c6298
0f9e25e
 
22c6298
0f9e25e
 
 
f8b0fab
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from langchain import SQLDatabaseChain
from langchain.sql_database import SQLDatabase
from langchain.llms.openai import OpenAI
from langchain.chat_models import ChatOpenAI
from langchain.prompts.prompt import PromptTemplate


def answer_question(query):
  if query.startswith("### Query"):
     split = query.split('/n')
     print(split)
  return("DONE: " + query)

if __name__ == "__main__":
    import gradio as gr
    # print(answer_question("Who is Harry's Father"))
    
    gr.Interface(
        answer_question,
        [
          gr.inputs.Textbox(lines=10, label="Query"),
        ],
        gr.outputs.Textbox(label="Response"),
        title="Ask NBA Stats",
        description=""" Ask NBA Stats is a tool that let's you ask a question with
                        the NBA SQL tables as a reference
                        
                        Ask a simple question to use the small database

                        If you would like to access the large DB use format
                        
                        ### Query
                        single line query
                        
                        ### Tables
                        tables to access line by line
                        table1
                        table2"""
    ).launch()