import winrm import gradio as gr # Uzak Windows makinesine bağlan session = winrm.Session( 'http://ec2-13-51-205-29.eu-north-1.compute.amazonaws.com:5985/wsman', auth=('Administrator', '(G40Si%D;L1YVzmKJB.ZZc@bGRfx6Sb;') ) # Log okuma fonksiyonu def read_logs(): command = 'Get-Content -Path "C:\\Users\\Administrator\\Documents\\win-x64\\publish\\PriceUpdater.log"' result = session.run_ps(command) # Farklı encodinglerle decode etmeyi dene try: return result.std_out.decode('utf-8') if result.std_out else "Log verisi yok." except UnicodeDecodeError: try: return result.std_out.decode('latin-1') except UnicodeDecodeError: return result.std_out.decode('cp1254', errors='ignore') # Türkçe Windows için uygun # Gradio arayüzü fonksiyonu def interface(): with gr.Blocks() as app: gr.Markdown("## 📜 Uzak Log Takip Ekranı") log_output = gr.Textbox(label="Log Çıktısı", interactive=False, lines=32) # Logları güncelleyen fonksiyon def update_logs(): logs = read_logs() return logs # Timer başlatma log_timer = gr.Timer(0.2, True) # 1 saniyede bir çalışır log_timer.tick( update_logs, # Fonksiyon outputs=log_output # Çıktıyı textbox'a bağla ) return app # Uygulamayı başlat app = interface() app.launch()