Spaces:
Sleeping
Sleeping
Commit
·
31cf81a
1
Parent(s):
aab5da0
added main part
Browse files
app.py
CHANGED
|
@@ -307,4 +307,46 @@ def create_interface():
|
|
| 307 |
}
|
| 308 |
"""
|
| 309 |
|
| 310 |
-
return demo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 307 |
}
|
| 308 |
"""
|
| 309 |
|
| 310 |
+
return demo
|
| 311 |
+
|
| 312 |
+
|
| 313 |
+
if __name__ == "__main__":
|
| 314 |
+
try:
|
| 315 |
+
log_message("🚀 Starting AIEXP - AI Expert for Regulatory Documentation")
|
| 316 |
+
|
| 317 |
+
# Initialize LLM
|
| 318 |
+
llm = GoogleGenAI(model="gemini-2.0-flash", api_key=GOOGLE_API_KEY)
|
| 319 |
+
Settings.llm = llm
|
| 320 |
+
|
| 321 |
+
# Initialize system
|
| 322 |
+
query_engine, chunks_df, success = initialize_system()
|
| 323 |
+
|
| 324 |
+
log_message("🌟 Starting web interface...")
|
| 325 |
+
demo = create_interface()
|
| 326 |
+
|
| 327 |
+
# Launch regardless of initialization success
|
| 328 |
+
demo.launch(
|
| 329 |
+
server_name="0.0.0.0",
|
| 330 |
+
server_port=7860,
|
| 331 |
+
share=True,
|
| 332 |
+
debug=False,
|
| 333 |
+
show_error=True
|
| 334 |
+
)
|
| 335 |
+
|
| 336 |
+
except Exception as e:
|
| 337 |
+
log_message(f"❌ Startup error: {str(e)}")
|
| 338 |
+
# Create minimal interface even if there's an error
|
| 339 |
+
import gradio as gr
|
| 340 |
+
|
| 341 |
+
def error_interface():
|
| 342 |
+
with gr.Blocks() as demo:
|
| 343 |
+
gr.Markdown(f"# Error: {str(e)}")
|
| 344 |
+
gr.Markdown("Please check your configuration and try again.")
|
| 345 |
+
return demo
|
| 346 |
+
|
| 347 |
+
error_demo = error_interface()
|
| 348 |
+
error_demo.launch(
|
| 349 |
+
server_name="0.0.0.0",
|
| 350 |
+
server_port=7860,
|
| 351 |
+
share=True
|
| 352 |
+
)
|