Spaces:
Runtime error
Runtime error
h3110Fr13nd
commited on
Commit
·
2b4a7b8
1
Parent(s):
4cbc9e9
changes
Browse files- Dockerfile +1 -1
- __pycache__/ddl_query_generator.cpython-311.pyc +0 -0
- __pycache__/wsgi.cpython-311.pyc +0 -0
- ddl_query_generator.py +9 -1
- wsgi.py +4 -0
Dockerfile
CHANGED
@@ -10,6 +10,6 @@ RUN python3.11 -m pip install --no-cache-dir -r requirements.txt
|
|
10 |
COPY . .
|
11 |
ENTRYPOINT ["/bin/sh"]
|
12 |
ENV FLASK_APP=ddl_query_generator.py
|
13 |
-
CMD ["/usr/bin/python3.11", "flask", "run", "
|
14 |
# CMD ["/usr/bin/python3.11", "ddl_query_generator.py"]
|
15 |
# flask run ddl_query_generator.py
|
|
|
10 |
COPY . .
|
11 |
ENTRYPOINT ["/bin/sh"]
|
12 |
ENV FLASK_APP=ddl_query_generator.py
|
13 |
+
CMD ["/usr/bin/python3.11", "flask", "run", "--host=0.0.0.0", "--port=7860"]
|
14 |
# CMD ["/usr/bin/python3.11", "ddl_query_generator.py"]
|
15 |
# flask run ddl_query_generator.py
|
__pycache__/ddl_query_generator.cpython-311.pyc
ADDED
Binary file (5.14 kB). View file
|
|
__pycache__/wsgi.cpython-311.pyc
ADDED
Binary file (400 Bytes). View file
|
|
ddl_query_generator.py
CHANGED
@@ -4,20 +4,26 @@ import warnings
|
|
4 |
import pandas as pd
|
5 |
from flask import Flask, render_template, request
|
6 |
from langchain_community.llms import Ollama
|
7 |
-
from
|
|
|
8 |
|
|
|
9 |
app = Flask(__name__)
|
10 |
|
11 |
# Suppressing warnings
|
12 |
warnings.filterwarnings("ignore")
|
13 |
|
14 |
# Initializing the language model
|
|
|
|
|
|
|
15 |
llm = Ollama(model="pxlksr/defog_sqlcoder-7b-2:Q4_K")
|
16 |
|
17 |
UPLOAD_FOLDER = 'uploads'
|
18 |
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
|
19 |
|
20 |
# Prompt template for language model
|
|
|
21 |
template = """
|
22 |
### Task
|
23 |
Generate a SQL query to answer [QUESTION]{user_question}[/QUESTION]
|
@@ -58,6 +64,7 @@ def run_sql_query(csv_files, sql_query):
|
|
58 |
history = []
|
59 |
history_dll = []
|
60 |
|
|
|
61 |
@app.route('/', methods=['GET', 'POST'])
|
62 |
def ddl_query():
|
63 |
ddl = None
|
@@ -97,4 +104,5 @@ def index():
|
|
97 |
return render_template('database_selection_index.html', result=result, query=query, history=history)
|
98 |
|
99 |
if __name__ == '__main__':
|
|
|
100 |
app.run(debug=True, port = 7860, host = '0.0.0.0')
|
|
|
4 |
import pandas as pd
|
5 |
from flask import Flask, render_template, request
|
6 |
from langchain_community.llms import Ollama
|
7 |
+
from langchain_core.prompts import PromptTemplate
|
8 |
+
from langchain.chains import LLMChain
|
9 |
|
10 |
+
print("Starting the server...")
|
11 |
app = Flask(__name__)
|
12 |
|
13 |
# Suppressing warnings
|
14 |
warnings.filterwarnings("ignore")
|
15 |
|
16 |
# Initializing the language model
|
17 |
+
|
18 |
+
# Ollama model
|
19 |
+
print("Initializing the language model...")
|
20 |
llm = Ollama(model="pxlksr/defog_sqlcoder-7b-2:Q4_K")
|
21 |
|
22 |
UPLOAD_FOLDER = 'uploads'
|
23 |
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
|
24 |
|
25 |
# Prompt template for language model
|
26 |
+
print("Initializing the prompt template...")
|
27 |
template = """
|
28 |
### Task
|
29 |
Generate a SQL query to answer [QUESTION]{user_question}[/QUESTION]
|
|
|
64 |
history = []
|
65 |
history_dll = []
|
66 |
|
67 |
+
print("Server started successfully!")
|
68 |
@app.route('/', methods=['GET', 'POST'])
|
69 |
def ddl_query():
|
70 |
ddl = None
|
|
|
104 |
return render_template('database_selection_index.html', result=result, query=query, history=history)
|
105 |
|
106 |
if __name__ == '__main__':
|
107 |
+
print("Running the server...")
|
108 |
app.run(debug=True, port = 7860, host = '0.0.0.0')
|
wsgi.py
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from ddl_query_generator import app
|
2 |
+
|
3 |
+
if __name__ == "__main__":
|
4 |
+
app.run(host='0.0.0.0', port=7860, debug=True)
|