File size: 2,837 Bytes
fcd463d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
"""
File download components
"""

import gradio as gr


def create_file_download_section():
    """Create file download section with individual file options"""
    
    with gr.Column(elem_classes="download-section"):
        gr.Markdown("### Generated Files")
        
        with gr.Row():
            # app.py download
            with gr.Column(scale=1):
                app_download = gr.File(
                    label="app.py",
                    file_types=[".py"],
                    interactive=False,
                    elem_classes="file-download"
                )
                
                gr.HTML('''
                <div class="file-info">
                    <span class="material-icons">description</span>
                    <span>Main application file</span>
                </div>
                ''')
            
            # requirements.txt download
            with gr.Column(scale=1):
                requirements_download = gr.File(
                    label="requirements.txt",
                    file_types=[".txt"],
                    interactive=False,
                    elem_classes="file-download"
                )
                
                gr.HTML('''
                <div class="file-info">
                    <span class="material-icons">list</span>
                    <span>Dependencies list</span>
                </div>
                ''')
            
            # README.md download
            with gr.Column(scale=1):
                readme_download = gr.File(
                    label="README.md",
                    file_types=[".md"],
                    interactive=False,
                    elem_classes="file-download"
                )
                
                gr.HTML('''
                <div class="file-info">
                    <span class="material-icons">article</span>
                    <span>Documentation</span>
                </div>
                ''')
        
        # Full package download
        gr.Markdown("### Complete Package")
        
        with gr.Row():
            with gr.Column():
                full_package_download = gr.File(
                    label="Full Application Package",
                    file_types=[".zip"],
                    interactive=False,
                    elem_classes="full-download"
                )
                
                gr.HTML('''
                <div class="package-info">
                    <span class="material-icons">folder_zip</span>
                    <span>Contains all files for deployment</span>
                </div>
                ''')
    
    return {
        "app_download": app_download,
        "requirements_download": requirements_download,
        "readme_download": readme_download,
        "full_package_download": full_package_download
    }