Update app.py
Browse files
app.py
CHANGED
@@ -158,3 +158,41 @@ for categoria in CATEGORIES:
|
|
158 |
st.rerun()
|
159 |
|
160 |
st.markdown("</div>", unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
st.rerun()
|
159 |
|
160 |
st.markdown("</div>", unsafe_allow_html=True)
|
161 |
+
# --- Função para listar arquivos do Dataset ---
|
162 |
+
def listar_arquivos_dataset(categoria):
|
163 |
+
"""
|
164 |
+
Lista arquivos na categoria escolhida do Dataset.
|
165 |
+
"""
|
166 |
+
arquivos = []
|
167 |
+
try:
|
168 |
+
todos_arquivos = list_repo_files(DATASET_REPO, repo_type="dataset")
|
169 |
+
prefixo = f"{categoria}/"
|
170 |
+
|
171 |
+
for arquivo in todos_arquivos:
|
172 |
+
if arquivo.startswith(prefixo):
|
173 |
+
arquivos.append(arquivo[len(prefixo):]) # Remove o prefixo da pasta
|
174 |
+
except Exception as e:
|
175 |
+
st.error(f"Erro ao listar arquivos do Dataset: {e}")
|
176 |
+
return arquivos
|
177 |
+
|
178 |
+
# --- Lista de Arquivos do Dataset ---
|
179 |
+
st.header("🌐 Vídeos Gerados (Dataset)")
|
180 |
+
|
181 |
+
for categoria in CATEGORIES:
|
182 |
+
arquivos_dataset = listar_arquivos_dataset(categoria)
|
183 |
+
|
184 |
+
st.subheader(f"📁 {categoria} (Dataset)")
|
185 |
+
|
186 |
+
if not arquivos_dataset:
|
187 |
+
st.info("Nenhum arquivo nesta categoria no Dataset.")
|
188 |
+
else:
|
189 |
+
for arquivo in arquivos_dataset:
|
190 |
+
url = hf_hub_url(
|
191 |
+
repo_id=DATASET_REPO,
|
192 |
+
filename=f"{categoria}/{arquivo}",
|
193 |
+
repo_type="dataset"
|
194 |
+
)
|
195 |
+
st.markdown(f"<div class='file-box'>", unsafe_allow_html=True)
|
196 |
+
st.markdown(f"<div class='file-name'>{arquivo}</div>", unsafe_allow_html=True)
|
197 |
+
st.markdown(f"[⬇ Download]({url})", unsafe_allow_html=True)
|
198 |
+
st.markdown("</div>", unsafe_allow_html=True)
|