Files
python_parser/python_parser/run_streamlit.py
2025-08-28 12:16:36 +03:00

51 lines
1.6 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
"""
Запуск Streamlit интерфейса для NIN Excel Parsers API
"""
import subprocess
import sys
import webbrowser
import time
def main():
"""Основная функция"""
print("🚀 ЗАПУСК STREAMLIT ИНТЕРФЕЙСА")
print("=" * 50)
print("Убедитесь, что FastAPI сервер запущен на порту 8000")
print("=" * 50)
# Проверяем, установлен ли Streamlit
try:
import streamlit
print(f"✅ Streamlit {streamlit.__version__} установлен")
except ImportError:
print("❌ Streamlit не установлен")
print("Установите: pip install streamlit")
return
print("\n🚀 Запускаю Streamlit...")
print("📍 URL: http://localhost:8501")
print("🛑 Для остановки нажмите Ctrl+C")
# Открываем браузер
try:
webbrowser.open("http://localhost:8501")
print("✅ Браузер открыт")
except Exception as e:
print(f"⚠️ Не удалось открыть браузер: {e}")
# Запускаем Streamlit
try:
subprocess.run([
sys.executable, "-m", "streamlit", "run", "streamlit_app.py",
"--server.port", "8501",
"--server.address", "localhost",
"--server.headless", "false",
"--browser.gatherUsageStats", "false"
])
except KeyboardInterrupt:
print("\n👋 Streamlit остановлен")
if __name__ == "__main__":
main()