priyesh17 commited on
Commit
d3eaa89
·
verified ·
1 Parent(s): 8503a62

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +43 -43
app.py CHANGED
@@ -1,43 +1,43 @@
1
- import streamlit as st
2
- import google.generativeai as genai
3
-
4
-
5
- genai.configure(api_key="AIzaSyCsaug0GuW8RbH3o-vCKpkFMOCDkEOoX94")
6
-
7
- model = genai.GenerativeModel('gemini-pro')
8
-
9
-
10
-
11
- st.set_page_config(page_title="AI SQL Query Generator")
12
- st.markdown(
13
- """
14
- <div style="text-align:center;">
15
- <h1> SQL Query Generator using LLM </h1>
16
- <h3>This tool can generate SQL queries for given prompt</h3>
17
- <h3>With Explanation of Queries </h3>
18
- </div>
19
- """,
20
- unsafe_allow_html=True,
21
- )
22
-
23
- text_input = st.text_area("Enter you Query here:")
24
-
25
- submit = st.button("Generate SQL Query")
26
-
27
- if submit:
28
- with st.spinner("Generating SQL Query..."):
29
- template = """
30
- Generate a SQL query for
31
- '''
32
- {text_input}
33
- '''
34
- Also explain the query and concepts used in generated query.
35
- """
36
- formatted_template = template.format(text_input=text_input)
37
-
38
- # st.write(formatted_template)
39
- response = model.generate_content(formatted_template)
40
- sql_query = response.text
41
- st.write("Generated query with explaination: ")
42
- st.write(sql_query)
43
-
 
1
+ import streamlit as st
2
+ import google.generativeai as genai
3
+
4
+
5
+ genai.configure(api_key="AIzaSyDHXUnKE7cPbgxMg7BrRSQkO1WIBD0PsuI")
6
+
7
+ model = genai.GenerativeModel('gemini-pro')
8
+
9
+
10
+
11
+ st.set_page_config(page_title="AI SQL Query Generator")
12
+ st.markdown(
13
+ """
14
+ <div style="text-align:center;">
15
+ <h1> SQL Query Generator using LLM </h1>
16
+ <h3>This tool can generate SQL queries for given prompt</h3>
17
+ <h3>With Explanation of Queries </h3>
18
+ </div>
19
+ """,
20
+ unsafe_allow_html=True,
21
+ )
22
+
23
+ text_input = st.text_area("Enter you Query here:")
24
+
25
+ submit = st.button("Generate SQL Query")
26
+
27
+ if submit:
28
+ with st.spinner("Generating SQL Query..."):
29
+ template = """
30
+ Generate a SQL query for
31
+ '''
32
+ {text_input}
33
+ '''
34
+ Also explain the query and concepts used in generated query.
35
+ """
36
+ formatted_template = template.format(text_input=text_input)
37
+
38
+ # st.write(formatted_template)
39
+ response = model.generate_content(formatted_template)
40
+ sql_query = response.text
41
+ st.write("Generated query with explaination: ")
42
+ st.write(sql_query)
43
+