Spaces:
Sleeping
Sleeping
AlainDeLong
commited on
Commit
•
3a786ba
1
Parent(s):
b3d93b8
update app
Browse files
app.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
import os
|
2 |
import streamlit as st
|
3 |
import sqlite3
|
4 |
import google.generativeai as genai
|
@@ -11,7 +10,7 @@ genai.configure(api_key=st.secrets["GOOGLE_API_KEY"])
|
|
11 |
def get_gemini_response(prompt, question):
|
12 |
# model = genai.GenerativeModel("gemini-1.5-flash")
|
13 |
model = genai.GenerativeModel("gemini-pro")
|
14 |
-
response = model.generate_content([prompt
|
15 |
return response.text
|
16 |
|
17 |
|
@@ -30,8 +29,7 @@ def read_sql_query(sql, db):
|
|
30 |
|
31 |
|
32 |
# Define prompt
|
33 |
-
prompt =
|
34 |
-
"""
|
35 |
You are an expert in converting English questions to SQL query!
|
36 |
The SQL database has 4 tables include STUDENT, LECTURER, COURSE, REGISTRATION FORM.
|
37 |
STUDENT has the following columns - ID_STU(primary key), NAME_STU, BIRTHDAY_STU and BIRTHPLACE_STU.
|
@@ -51,7 +49,6 @@ prompt = [
|
|
51 |
|
52 |
note that the SQL code must not start and end with ``` and must not contain the "sql" word in output.
|
53 |
"""
|
54 |
-
]
|
55 |
|
56 |
# Streamlit App
|
57 |
st.set_page_config(page_title="Text to SQL")
|
|
|
|
|
1 |
import streamlit as st
|
2 |
import sqlite3
|
3 |
import google.generativeai as genai
|
|
|
10 |
def get_gemini_response(prompt, question):
|
11 |
# model = genai.GenerativeModel("gemini-1.5-flash")
|
12 |
model = genai.GenerativeModel("gemini-pro")
|
13 |
+
response = model.generate_content([prompt, question])
|
14 |
return response.text
|
15 |
|
16 |
|
|
|
29 |
|
30 |
|
31 |
# Define prompt
|
32 |
+
prompt = """
|
|
|
33 |
You are an expert in converting English questions to SQL query!
|
34 |
The SQL database has 4 tables include STUDENT, LECTURER, COURSE, REGISTRATION FORM.
|
35 |
STUDENT has the following columns - ID_STU(primary key), NAME_STU, BIRTHDAY_STU and BIRTHPLACE_STU.
|
|
|
49 |
|
50 |
note that the SQL code must not start and end with ``` and must not contain the "sql" word in output.
|
51 |
"""
|
|
|
52 |
|
53 |
# Streamlit App
|
54 |
st.set_page_config(page_title="Text to SQL")
|