Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -252,29 +252,22 @@ def create_app():
|
|
| 252 |
|
| 253 |
# Create the app for Hugging Face Spaces
|
| 254 |
# Spaces will automatically detect Gradio and run this
|
| 255 |
-
#
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
outputs=gr.Textbox(),
|
| 274 |
-
title="CSRC Car Manual RAG System - Error",
|
| 275 |
-
description="An error occurred during initialization. Please check the logs."
|
| 276 |
-
)
|
| 277 |
-
_demo_initialized = True
|
| 278 |
-
else:
|
| 279 |
-
print("βΉοΈ App already initialized, reusing existing instance")
|
| 280 |
|
|
|
|
| 252 |
|
| 253 |
# Create the app for Hugging Face Spaces
|
| 254 |
# Spaces will automatically detect Gradio and run this
|
| 255 |
+
# Note: Spaces may import the module multiple times, but we only create demo once at module level
|
| 256 |
+
try:
|
| 257 |
+
print("π Initializing app...")
|
| 258 |
+
demo = create_app()
|
| 259 |
+
print("β
App initialized successfully!")
|
| 260 |
+
except Exception as e:
|
| 261 |
+
print(f"β Error creating app: {e}")
|
| 262 |
+
import traceback
|
| 263 |
+
traceback.print_exc()
|
| 264 |
+
# Create a minimal error interface
|
| 265 |
+
import gradio as gr
|
| 266 |
+
demo = gr.Interface(
|
| 267 |
+
fn=lambda: f"Error: {str(e)}\n\nPlease check the logs for details.",
|
| 268 |
+
inputs=None,
|
| 269 |
+
outputs=gr.Textbox(),
|
| 270 |
+
title="CSRC Car Manual RAG System - Error",
|
| 271 |
+
description="An error occurred during initialization. Please check the logs."
|
| 272 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 273 |
|