teaevo commited on
Commit
50de467
·
1 Parent(s): 1f73097

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -5
app.py CHANGED
@@ -12,17 +12,36 @@ def execute_sql(user_query):
12
 
13
  return response
14
 
15
- # Define the chatbot interface using Gradio
16
- iface = gr.Interface(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  fn=execute_sql,
18
  inputs=gr.Textbox(prompt="Enter your SQL query:"),
19
  outputs=gr.Textbox(),
20
  live=True,
21
  capture_session=True,
22
- title="SQL Execution Chatbot",
23
  description="Type your SQL query in the box above, and the chatbot will execute it.",
24
  )
25
 
26
- # Launch the Gradio interface
 
 
 
27
  if __name__ == "__main__":
28
- iface.launch()
 
12
 
13
  return response
14
 
15
+ def chatbot_response(user_message):
16
+ # Your chatbot code goes here (using GPT-2 or any other text generation model)
17
+ # For example, you can use the GPT-2 code from the previous responses
18
+
19
+ return chatbot_generated_response
20
+
21
+ # Define the chatbot and SQL execution interface using Gradio
22
+ chatbot_interface = gr.Interface(
23
+ fn=chatbot_response,
24
+ inputs=gr.Textbox(prompt="You:"),
25
+ outputs=gr.Textbox(),
26
+ live=True,
27
+ capture_session=True,
28
+ title="Chatbot",
29
+ description="Type your message in the box above, and the chatbot will respond.",
30
+ )
31
+
32
+ sql_execution_interface = gr.Interface(
33
  fn=execute_sql,
34
  inputs=gr.Textbox(prompt="Enter your SQL query:"),
35
  outputs=gr.Textbox(),
36
  live=True,
37
  capture_session=True,
38
+ title="SQL Execution",
39
  description="Type your SQL query in the box above, and the chatbot will execute it.",
40
  )
41
 
42
+ # Combine the chatbot and SQL execution interfaces
43
+ combined_interface = gr.Interface([chatbot_interface, sql_execution_interface], layout="horizontal")
44
+
45
+ # Launch the combined Gradio interface
46
  if __name__ == "__main__":
47
+ combined_interface.launch()