arjunanand13 commited on
Commit
4e0694e
·
verified ·
1 Parent(s): 4851168

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -11
app.py CHANGED
@@ -6,7 +6,7 @@ import google.generativeai as genai
6
  import time
7
 
8
  # Initialize Gemini
9
- genai.configure(api_key="AIzaSyCnuJMrTkckScv0YxAaaQzH1LDomNUUppA")
10
  genai_model = genai.GenerativeModel('gemini-pro')
11
 
12
  class SQLPromptModel:
@@ -89,14 +89,27 @@ with gr.Blocks(title="House Database Query") as demo:
89
  gr.Markdown("""### The database contains information about different properties including their fundamental details.
90
  You can query this database using natural language.""")
91
 
92
- # Query input and output
93
- query_input = gr.Textbox(
94
- lines=2,
95
- label="Database Query",
96
- placeholder="Enter your query or choose from examples below. Default: 'Properties in India'"
97
- )
 
 
 
 
 
 
 
 
98
 
99
- query_output = gr.JSON(label="Query Results")
 
 
 
 
 
100
 
101
  # Example queries
102
  gr.Examples(
@@ -109,9 +122,6 @@ with gr.Blocks(title="House Database Query") as demo:
109
  outputs=query_output,
110
  fn=execute_sql_query
111
  )
112
-
113
- # Submit button
114
- query_input.submit(fn=execute_sql_query, inputs=query_input, outputs=query_output)
115
 
116
  if __name__ == "__main__":
117
  demo.launch(share=True)
 
6
  import time
7
 
8
  # Initialize Gemini
9
+ genai.configure(api_key="YOUR_GEMINI_API_KEY")
10
  genai_model = genai.GenerativeModel('gemini-pro')
11
 
12
  class SQLPromptModel:
 
89
  gr.Markdown("""### The database contains information about different properties including their fundamental details.
90
  You can query this database using natural language.""")
91
 
92
+ with gr.Row():
93
+ # Query input and output
94
+ query_input = gr.Textbox(
95
+ lines=2,
96
+ label="Database Query",
97
+ placeholder="Enter your query or choose from examples below. Default: 'Properties in India'"
98
+ )
99
+
100
+ with gr.Row():
101
+ # Add submit button
102
+ submit_btn = gr.Button("Submit Query", variant="primary")
103
+
104
+ with gr.Row():
105
+ query_output = gr.JSON(label="Query Results")
106
 
107
+ # Connect submit button to the query function
108
+ submit_btn.click(
109
+ fn=execute_sql_query,
110
+ inputs=query_input,
111
+ outputs=query_output
112
+ )
113
 
114
  # Example queries
115
  gr.Examples(
 
122
  outputs=query_output,
123
  fn=execute_sql_query
124
  )
 
 
 
125
 
126
  if __name__ == "__main__":
127
  demo.launch(share=True)