pydeploy-studio / components /file_downloader.py
codeboosterstech's picture
Upload 12 files
fcd463d verified
"""
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
}