abid-ai commited on
Commit
7044752
ยท
verified ยท
1 Parent(s): 517c84a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +45 -14
app.py CHANGED
@@ -106,37 +106,68 @@ rag_chain = (
106
  # ==========================================
107
  # 4. PROFESSIONAL FRONTEND (GRADIO BLOCKS)
108
  # ==========================================
 
 
 
 
 
 
 
109
  custom_css = """
110
  #main-container { max-width: 900px; margin: auto; padding: 20px; }
111
  .header-text { text-align: center; color: #1e293b; margin-bottom: 2px; }
112
- .report-box { background-color: #ffffff; border-radius: 8px; border: 1px solid #e2e8f0; padding: 15px; min-height: 200px; }
113
- """
114
 
115
- def process_query(query):
116
- if not query.strip():
117
- return "### โš ๏ธ System Note\n*Please enter a strategic inquiry to begin analysis.*"
118
- try:
119
- return rag_chain.invoke(query)
120
- except Exception as e:
121
- return f"### โŒ Error\nAn error occurred: {str(e)}"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
 
123
  with gr.Blocks(theme=gr.themes.Soft(primary_hue="indigo"), css=custom_css) as demo:
124
  with gr.Column(elem_id="main-container"):
125
- gr.Markdown("# ๐Ÿ›๏ธ Enterprise Knowledge Engine", elem_classes="header-text")
126
- gr.Markdown("<p style='text-align: center;'>Multi-Source Document Synthesis via Groq & FAISS</p>")
127
  gr.HTML("<hr>")
128
 
129
- user_input = gr.Textbox(label="Strategic Inquiry", placeholder="Ask a question about the collected knowledge base...", lines=3)
 
 
 
 
130
 
131
  with gr.Row():
132
  submit_btn = gr.Button("ANALYZE DATA", variant="primary", scale=2)
133
- clear_btn = gr.ClearButton([user_input], value="RESET DASHBOARD", scale=1)
134
 
135
  gr.Markdown("### ๐Ÿ“‹ Intelligence Report")
 
 
136
  with gr.Column(elem_classes="report-box"):
137
- output_display = gr.Markdown(value="_Awaiting input..._")
 
 
138
 
139
  submit_btn.click(fn=process_query, inputs=user_input, outputs=output_display)
140
  user_input.submit(fn=process_query, inputs=user_input, outputs=output_display)
141
 
 
142
  demo.launch(share=True)
 
106
  # ==========================================
107
  # 4. PROFESSIONAL FRONTEND (GRADIO BLOCKS)
108
  # ==========================================
109
+
110
+
111
+ # ==========================================
112
+ # 4. PROFESSIONAL FRONTEND (STYLING FIXED)
113
+ # ==========================================
114
+
115
+ # Improved CSS for high-contrast visibility
116
  custom_css = """
117
  #main-container { max-width: 900px; margin: auto; padding: 20px; }
118
  .header-text { text-align: center; color: #1e293b; margin-bottom: 2px; }
 
 
119
 
120
+ /* The result box styling */
121
+ .report-box {
122
+ background-color: #ffffff !important;
123
+ border-radius: 12px !important;
124
+ border: 2px solid #4f46e5 !important;
125
+ padding: 20px !important;
126
+ min-height: 250px !important;
127
+ box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1) !important;
128
+ }
129
+
130
+ /* Force text inside the result box to be Bold Black */
131
+ .report-box p, .report-box span, .report-box div {
132
+ color: #000000 !important;
133
+ font-weight: 500 !important;
134
+ font-size: 1.1rem !important;
135
+ }
136
+
137
+ /* Ensure Markdown headers (# Header) are extra bold and dark */
138
+ .report-box h1, .report-box h2, .report-box h3 {
139
+ color: #1e1b4b !important;
140
+ font-weight: 800 !important;
141
+ border-bottom: 1px solid #e2e8f0;
142
+ }
143
+ """
144
 
145
  with gr.Blocks(theme=gr.themes.Soft(primary_hue="indigo"), css=custom_css) as demo:
146
  with gr.Column(elem_id="main-container"):
147
+ gr.Markdown("# ๐Ÿ›๏ธ ByteWise: CS Intelligence", elem_classes="header-text")
148
+ gr.Markdown("<p style='text-align: center;'>Specialized Synthesis for Assembly & Data Structures</p>")
149
  gr.HTML("<hr>")
150
 
151
+ user_input = gr.Textbox(
152
+ label="Strategic Inquiry",
153
+ placeholder="Ask a question about Assembly or Data Structures...",
154
+ lines=3
155
+ )
156
 
157
  with gr.Row():
158
  submit_btn = gr.Button("ANALYZE DATA", variant="primary", scale=2)
159
+ clear_btn = gr.ClearButton([user_input], value="RESET", scale=1)
160
 
161
  gr.Markdown("### ๐Ÿ“‹ Intelligence Report")
162
+
163
+ # We apply 'report-box' here to ensure the Markdown inherits the high-contrast CSS
164
  with gr.Column(elem_classes="report-box"):
165
+ output_display = gr.Markdown(
166
+ value="_Awaiting input... Results will appear here in high-contrast black text._"
167
+ )
168
 
169
  submit_btn.click(fn=process_query, inputs=user_input, outputs=output_display)
170
  user_input.submit(fn=process_query, inputs=user_input, outputs=output_display)
171
 
172
+ # Launch
173
  demo.launch(share=True)