file-management / app.py
chandralegend's picture
added the initial implementation
4b2acc6
import streamlit as st
import os
import uuid
st.header("Testing File Creation in HuggingFace")
if st.button("Create File"):
random_file_name = str(uuid.uuid4())
with open(f"{random_file_name}.txt", "w") as f:
f.write("Hello World!")
st.info(f"Created file {random_file_name}.txt")
file_name = st.text_input("Enter file name to delete")
if st.button("Delete File"):
if os.path.exists(file_name):
os.remove(file_name)
st.info(f"Deleted file {file_name}")
else:
st.error(f"File {file_name} does not exist")
if st.button("List Files"):
st.info(os.listdir())