Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -692,5 +692,28 @@ with gr.Blocks(title="Axon v6") as demo:
|
|
| 692 |
mock_btn.click(generate_mock_data, [mock_schema, mock_count, mock_format, model_dropdown, max_tokens], mock_output)
|
| 693 |
format_btn.click(convert_data_format, [format_input, format_from, format_to, model_dropdown, max_tokens], format_output)
|
| 694 |
|
|
|
|
| 695 |
print("🔥 Axon v6 starting...")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 696 |
demo.launch(server_name="0.0.0.0", server_port=7860, theme=gr.themes.Soft(primary_hue="indigo"))
|
|
|
|
| 692 |
mock_btn.click(generate_mock_data, [mock_schema, mock_count, mock_format, model_dropdown, max_tokens], mock_output)
|
| 693 |
format_btn.click(convert_data_format, [format_input, format_from, format_to, model_dropdown, max_tokens], format_output)
|
| 694 |
|
| 695 |
+
# Pre-download ALL models on startup
|
| 696 |
print("🔥 Axon v6 starting...")
|
| 697 |
+
print("⬇️ Pre-downloading all models...")
|
| 698 |
+
|
| 699 |
+
for model_name in MODELS.keys():
|
| 700 |
+
print(f"📥 Checking {model_name}...")
|
| 701 |
+
filename = MODELS[model_name]
|
| 702 |
+
model_path = os.path.join(MODELS_DIR, filename)
|
| 703 |
+
|
| 704 |
+
if not os.path.exists(model_path):
|
| 705 |
+
repo_id = MODEL_REPOS.get(filename)
|
| 706 |
+
if repo_id:
|
| 707 |
+
print(f"⬇️ Downloading {filename}...")
|
| 708 |
+
try:
|
| 709 |
+
hf_hub_download(repo_id=repo_id, filename=filename, local_dir=MODELS_DIR)
|
| 710 |
+
print(f"✅ {filename} downloaded!")
|
| 711 |
+
except Exception as e:
|
| 712 |
+
print(f"❌ Failed to download {filename}: {e}")
|
| 713 |
+
else:
|
| 714 |
+
print(f"✅ {filename} already cached")
|
| 715 |
+
|
| 716 |
+
print("✅ All models ready!")
|
| 717 |
+
print("🚀 Launching Axon...")
|
| 718 |
+
|
| 719 |
demo.launch(server_name="0.0.0.0", server_port=7860, theme=gr.themes.Soft(primary_hue="indigo"))
|