Spaces:
Sleeping
Sleeping
Create app.py
Browse filesInitial commit
app.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import time
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
def main():
|
| 7 |
+
st.title("File Upload and Display")
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
# File upload
|
| 12 |
+
uploaded_file = st.file_uploader("Upload a file")
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
if uploaded_file is not None:
|
| 17 |
+
# Display file contents using st.markdown()
|
| 18 |
+
file_contents = uploaded_file.read().decode("utf-8")
|
| 19 |
+
st.markdown("### File Contents:")
|
| 20 |
+
st.markdown(f"```{file_contents}```")
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
# Wait for 5 seconds
|
| 25 |
+
time.sleep(5)
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
# Show completed message
|
| 30 |
+
st.success("File processing completed!")
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
if __name__ == "__main__":
|
| 35 |
+
main()
|