shivay00001 commited on
Commit
a7e9027
·
verified ·
1 Parent(s): cc27729

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -14
app.py CHANGED
@@ -2365,17 +2365,35 @@ def main():
2365
  )
2366
 
2367
  if __name__ == "__main__":
2368
- main()
2369
- '''
2370
-
2371
- # Example usage and testing
2372
- if __name__ == "__main__":
2373
- # Create and run application
2374
- app = MainApplication()
2375
- app.setup()
2376
-
2377
- # Create deployment package
2378
- app.create_deployment_package()
2379
-
2380
- # Run with Gradio interface (default)
2381
- app.run("gradio", port=7860, share=False)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2365
  )
2366
 
2367
  if __name__ == "__main__":
2368
+ try:
2369
+ config = ModelConfig()
2370
+ ai_model = AdvancedAIModel(config)
2371
+ interface = GradioInterface(ai_model)
2372
+ app = interface.create_interface()
2373
+
2374
+ # Hugging Face Spaces compatible launch
2375
+ app.launch(
2376
+ server_name="0.0.0.0",
2377
+ server_port=7860,
2378
+ share=True, # Must be True for HF Spaces
2379
+ enable_queue=True
2380
+ )
2381
+ except Exception as e:
2382
+ print(f"Error: {e}")
2383
+ # Simple fallback interface
2384
+ import gradio as gr
2385
+
2386
+ def simple_chat(message):
2387
+ return f"AI model loading... Please wait. Error: {str(e)}"
2388
+
2389
+ demo = gr.Interface(
2390
+ fn=simple_chat,
2391
+ inputs="text",
2392
+ outputs="text",
2393
+ title="Cosmic AI - Loading..."
2394
+ )
2395
+ demo.launch(
2396
+ server_name="0.0.0.0",
2397
+ server_port=7860,
2398
+ share=True # Important for HF Spaces
2399
+ )