Sayandip commited on
Commit
c9c4066
·
verified ·
1 Parent(s): c077032

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -27
app.py CHANGED
@@ -128,35 +128,20 @@ def ask_agent(question: str) -> str:
128
  return result_str or "No results."
129
  return str(result)
130
  except Exception as e:
131
- return f"⚠️ Error: {str(e)}"
132
 
133
  with gr.Blocks() as demo:
134
- gr.Markdown("## 🏫 Text to SQL Agent")
135
-
136
- with gr.Row():
137
- # --- Left column: tables (smaller) ---
138
- with gr.Column(scale=1):
139
- gr.Markdown("### Students Table")
140
- gr.DataFrame(value=students_df, interactive=False, height=200)
141
- gr.Markdown("### Subjects Table")
142
- gr.DataFrame(value=subjects_df, interactive=False, height=200)
143
- gr.Markdown("### Sample Prompts")
144
- for prompt in sample_prompts:
145
- gr.Markdown(f"- {prompt}")
146
-
147
- # --- Right column: question & response (larger) ---
148
- with gr.Column(scale=2):
149
- gr.Markdown("### Ask questions about students, subjects, marks, and teachers")
150
- question_input = gr.Textbox(
151
- label="Your question",
152
- placeholder="e.g., Which student scored highest in Math?",
153
- lines=2
154
- )
155
- answer_output = gr.Textbox(
156
- label="Agent response",
157
- lines=20
158
- )
159
-
160
  question_input.submit(fn=ask_agent, inputs=question_input, outputs=answer_output)
161
 
162
  demo.launch()
 
128
  return result_str or "No results."
129
  return str(result)
130
  except Exception as e:
131
+ return f" Error: {str(e)}"
132
 
133
  with gr.Blocks() as demo:
134
+ gr.Markdown("## Text to SQL Agent")
135
+ gr.Markdown("### Students Table")
136
+ gr.DataFrame(value=students_df, interactive=False)
137
+ gr.Markdown("### Subjects Table")
138
+ gr.DataFrame(value=subjects_df, interactive=False)
139
+ gr.Markdown("### Ask questions about students, subjects, marks, and teachers")
140
+ question_input = gr.Textbox(label="Your question", placeholder="e.g., Which student scored highest in Math?")
141
+ answer_output = gr.Textbox(label="Agent response")
142
+ gr.Markdown("### Sample Prompts")
143
+ for prompt in sample_prompts:
144
+ gr.Markdown(f"- {prompt}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
  question_input.submit(fn=ask_agent, inputs=question_input, outputs=answer_output)
146
 
147
  demo.launch()