Spaces:
Sleeping
Sleeping
5 pages test: page1→page2→page3→page4→results
Browse files12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273"""Minimal test - 4 pages simulating the full flow"""import gradio as grwith gr.Blocks(title="Legacy Code Challenge - Test") as demo:# Page 1: Loginwith gr.Column(visible=True) as page1:gr.Markdown("# 🔐 עמוד התחברות")gr.Markdown("הזן שם וAPI key")name_input = gr.Textbox(label="שם", value="Test User")api_input = gr.Textbox(label="API Key", type="password", value="test-key")btn1 = gr.Button("התחבר ➡️", variant="primary", size="lg")# Page 2: Setup Challengewith gr.Column(visible=False) as page2:gr.Markdown("# ⚙️ הגדרת אתגר")gr.Markdown("בחר repository ורמת קושי")url_input = gr.Textbox(label="GitHub URL", value="https://github.com/test/repo")difficulty = gr.Slider(1, 5, value=3, label="קושי")btn2 = gr.Button("התחל אתגר ➡️", variant="primary", size="lg")# Page 3: Challenge (coding)with gr.Column(visible=False) as page3:gr.Markdown("# 💻 עמוד האתגר")gr.Markdown("כאן תקבל את הקוד המקולקל")gr.Markdown("```python\n# Your buggy code here\nprint('Hello')\n```")gr.Textbox(label="ערוך את הקוד כאן", lines=10, value="# Fix the bugs here\nprint('Hello')")btn3 = gr.Button("שלח ➡️", variant="primary", size="lg")# Page 4: Resultswith gr.Column(visible=False) as page4:gr.Markdown("# 🎯 תוצאות")gr.HTML("<h2 style='color:green;text-align:center;'>✅ עמוד התוצאות עובד!</h2>")results_html = gr.HTML("""<div style='padding:20px;background:#f0f0f0;border-radius:10px;'><h3>ציון: 85/100</h3><p>✅ 8 מתוך 10 טסטים עברו</p><p>📝 שינויים: 5 שורות</p><p>💡 רמזים: 2</p></div>""")def switch_to_setup():return (gr.update(visible=False), # page1gr.update(visible=True), # page2gr.update(visible=False), # page3gr.update(visible=False), # page4)def switch_to_challenge():return (gr.update(visible=False), # page1gr.update(visible=False), # page2gr.update(visible=True), # page3gr.update(visible=False), # page4)def switch_to_results():return (gr.update(visible=False), # page1gr.update(visible=False), # page2gr.update(visible=False), # page3gr.update(visible=True), # page4)btn1.click(fn=switch_to_setup, inputs=[], outputs=[page1, page2, page3, page4])btn2.click(fn=switch_to_challenge, inputs=[], outputs=[page1, page2, page3, page4])btn3.click(fn=switch_to_results, inputs=[], outputs=[page1, page2, page3, page4])# Enable queue for server compatibilitydemo.queue()if __name__ == "__main__":123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263"""Minimal test - 5 simple pages"""import gradio as grwith gr.Blocks(title="Test 5 Pages") as demo:# Page 1with gr.Column(visible=True) as page1:gr.Markdown("# עמוד 1 - התחלה")gr.HTML("<p style='font-size:20px;'>זהו העמוד הראשון</p>")btn1 = gr.Button("➡️ עמוד 2", variant="primary", size="lg")# Page 2with gr.Column(visible=False) as page2:gr.Markdown("# עמוד 2")gr.HTML("<p style='color:blue;'>✅ מעבר 1 הצליח!</p>")btn2 = gr.Button("➡️ עמוד 3", variant="primary", size="lg")# Page 3with gr.Column(visible=False) as page3:gr.Markdown("# עמוד 3")gr.HTML("<p style='color:green;'>✅✅ מעבר 2 הצליח!</p>")btn3 = gr.Button("➡️ עמוד 4", variant="primary", size="lg")# Page 4with gr.Column(visible=False) as page4:gr.Markdown("# עמוד 4")gr.HTML("<p style='color:orange;'>✅✅✅ מעבר 3 הצליח!</p>")btn4 = gr.Button("➡️ עמוד 5 (תוצאות)", variant="primary", size="lg")# Page 5 - Resultswith gr.Column(visible=False) as page5:gr.Markdown("# 🎯 עמוד 5 - תוצאות")gr.HTML("<h2 style='color:green;text-align:center;'>✅✅✅✅ כל המעברים עבדו!</h2>")gr.HTML("""<div style='padding:20px;background:#e8f5e9;border-radius:10px;margin-top:20px;'><h3>ציון: 100/100</h3><p>✅ כל 5 העמודים עובדים מצוין!</p></div>""")def goto_page2():return (gr.update(visible=False), gr.update(visible=True),gr.update(visible=False), gr.update(visible=False), gr.update(visible=False))def goto_page3():return (gr.update(visible=False), gr.update(visible=False),gr.update(visible=True), gr.update(visible=False), gr.update(visible=False))def goto_page4():return (gr.update(visible=False), gr.update(visible=False),gr.update(visible=False), gr.update(visible=True), gr.update(visible=False))def goto_page5():return (gr.update(visible=False), gr.update(visible=False),gr.update(visible=False), gr.update(visible=False), gr.update(visible=True))btn1.click(fn=goto_page2, inputs=[], outputs=[page1, page2, page3, page4, page5])btn2.click(fn=goto_page3, inputs=[], outputs=[page1, page2, page3, page4, page5])btn3.click(fn=goto_page4, inputs=[], outputs=[page1, page2, page3, page4, page5])btn4.click(fn=goto_page5, inputs=[], outputs=[page1, page2, page3, page4, page5])demo.queue()if __name__ == "__main__":
minimal_test.py+44-54