Spaces:
Build error
Build error
| import gradio as gr | |
| def create_documentation_viewer(): | |
| with gr.Blocks( | |
| title="Professionelle modulare Code-Dokumentation", | |
| css=""" | |
| .doc-container { | |
| max-width: 100%; | |
| margin: 0 auto; | |
| padding: 20px; /* Desktop Standard */ | |
| } | |
| .responsive-code { | |
| font-family: 'Monaco', 'Consolas', 'Courier New', monospace; | |
| font-size: 14px; | |
| white-space: pre-wrap; | |
| word-wrap: break-word; | |
| overflow-x: auto; | |
| background: #f6f8fa; | |
| padding: 20px; | |
| border-radius: 8px; | |
| border: 1px solid #e1e4e8; | |
| } | |
| .back-button { | |
| margin-left: 20px; | |
| } | |
| /* Tablet */ | |
| @media (max-width: 1024px) and (min-width: 769px) { | |
| .doc-container { | |
| padding: 15px; | |
| } | |
| .responsive-code { | |
| font-size: 13px; | |
| padding: 15px; | |
| } | |
| } | |
| /* Mobile */ | |
| @media (max-width: 768px) and (min-width: 481px) { | |
| .doc-container { | |
| padding: 10px; | |
| } | |
| .responsive-code { | |
| font-size: 12px; | |
| padding: 10px; | |
| line-height: 1.4; | |
| } | |
| } | |
| /* Small Mobile */ | |
| @media (max-width: 480px) { | |
| .doc-container { | |
| padding: 5px; | |
| } | |
| .responsive-code { | |
| font-size: 11px; | |
| padding: 8px; | |
| line-height: 1.3; | |
| } | |
| } | |
| """ | |
| ) as demo: | |
| # Header mit Titel und Zurück-Button | |
| with gr.Row(): | |
| gr.Markdown("# 📋 Professionelle modulare Code-Dokumentation") | |
| gr.HTML( | |
| '<a href="https://huggingface.co/spaces/Astridkraft/Text-Bild_zu_Bild" ' | |
| 'target="_blank" style="margin-left: 20px;">' | |
| #'<button style="padding: 8px 16px; background: #FF9800; color: white; ' | |
| '<button style="padding: 8px 16px; background: #1E90FF; color: white; ' | |
| 'border: none; border-radius: 4px; cursor: pointer; font-weight: bold;">Zurück</button></a>' | |
| ) | |
| def create_tab_content(filename, tab_id): | |
| try: | |
| with open(filename, "r", encoding="utf-8") as f: | |
| content = f.read() | |
| return gr.Textbox( | |
| value=content, | |
| lines=30, | |
| max_lines=50, | |
| show_copy_button=True, | |
| label=f"Inhalt von {filename}", | |
| elem_classes="responsive-code" | |
| ) | |
| except FileNotFoundError: | |
| return gr.Markdown(f"⚠️ Datei '{filename}' nicht gefunden") | |
| # [Ihre Tabs bleiben gleich...] | |
| with gr.Tab("Main.py", id="main-py"): | |
| with gr.Column(elem_classes="doc-container"): | |
| create_tab_content("Main.py", "main-py") | |
| with gr.Tab("🎨 inpaint_module.py", id="inpaint-module-py"): | |
| with gr.Column(elem_classes="doc-container"): | |
| create_tab_content("inpaint_module.py", "inpaint-module-py") | |
| with gr.Tab("📝 textGenerator_module.py", id="text-generator-module-py"): | |
| with gr.Column(elem_classes="doc-container"): | |
| create_tab_content("textGenerator_module.py", "text-generator-module-py") | |
| with gr.Tab("🖥️ UI-Gradio.py", id="ui-gradio-py"): | |
| with gr.Column(elem_classes="doc-container"): | |
| create_tab_content("UI-Gradio.py", "ui-gradio-py") | |
| with gr.Tab("⚙️ Pipeline-Orchestrator.py", id="pipeline-orchestrator-py"): | |
| with gr.Column(elem_classes="doc-container"): | |
| create_tab_content("Pipeline-Orchestrator.py", "pipeline-orchestrator-py") | |
| return demo | |
| if __name__ == "__main__": | |
| demo = create_documentation_viewer() | |
| demo.launch(server_name="0.0.0.0", server_port=7860) |