Spaces:
Sleeping
Sleeping
Update pages/Data Collection.py
Browse files- pages/Data Collection.py +94 -0
pages/Data Collection.py
CHANGED
|
@@ -1361,6 +1361,20 @@ def main_page():
|
|
| 1361 |
- Sales records in a database.
|
| 1362 |
""")
|
| 1363 |
st.write("**💡 Simple Story:** Think of a grocery store where every item has its price, category, and stock neatly listed on a computer.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1364 |
|
| 1365 |
if st.button("Excel"):
|
| 1366 |
st.session_state['page'] = "excel"
|
|
@@ -1375,9 +1389,61 @@ def main_page():
|
|
| 1375 |
- JSON or XML files used in apps and websites.
|
| 1376 |
""")
|
| 1377 |
st.write("**💡 Simple Story:** Imagine writing a letter that has a date, sender’s name, and the main message. It’s structured in parts but not as fixed as a table.")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1378 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1379 |
st.write("Semi-Structured Data includes formats like CSV, JSON, XML, and HTML.")
|
| 1380 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1381 |
if st.button("CSV"):
|
| 1382 |
st.session_state['page'] = "csv"
|
| 1383 |
if st.button("JSON"):
|
|
@@ -1402,6 +1468,34 @@ def main_page():
|
|
| 1402 |
|
| 1403 |
st.write("Unstructured Data includes formats like Images and Videos.")
|
| 1404 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1405 |
if st.button("Image"):
|
| 1406 |
st.session_state['page'] = "image"
|
| 1407 |
if st.button("Video"):
|
|
|
|
| 1361 |
- Sales records in a database.
|
| 1362 |
""")
|
| 1363 |
st.write("**💡 Simple Story:** Think of a grocery store where every item has its price, category, and stock neatly listed on a computer.")
|
| 1364 |
+
names = ["Hari", "Harika", "Varshi", "Shamitha"]
|
| 1365 |
+
cities = ["Hyderabad", "Bangalore", "Chennai", "Mumbai"]
|
| 1366 |
+
marks = [90, 87, 98, 94]
|
| 1367 |
+
|
| 1368 |
+
# Create the DataFrame
|
| 1369 |
+
data = {
|
| 1370 |
+
"Name": names,
|
| 1371 |
+
"City": cities,
|
| 1372 |
+
"Marks": marks
|
| 1373 |
+
}
|
| 1374 |
+
df = pd.DataFrame(data)
|
| 1375 |
+
|
| 1376 |
+
st.subheader("Details of Students")
|
| 1377 |
+
st.table(df)
|
| 1378 |
|
| 1379 |
if st.button("Excel"):
|
| 1380 |
st.session_state['page'] = "excel"
|
|
|
|
| 1389 |
- JSON or XML files used in apps and websites.
|
| 1390 |
""")
|
| 1391 |
st.write("**💡 Simple Story:** Imagine writing a letter that has a date, sender’s name, and the main message. It’s structured in parts but not as fixed as a table.")
|
| 1392 |
+
st.markdown("""
|
| 1393 |
+
Unlike structured data, **semi-structured data** does not require a fixed schema.
|
| 1394 |
+
However, it often includes tags or markers to separate elements. This means that the data can be organized in a flexible way, allowing you to add new data elements without disturbing the existing ones.
|
| 1395 |
+
""")
|
| 1396 |
|
| 1397 |
+
# Display explanation for Self-Descriptive Tags
|
| 1398 |
+
st.subheader("Self-Descriptive Tags:")
|
| 1399 |
+
st.markdown("""
|
| 1400 |
+
Semi-structured data uses **tags** or **keys** to identify and describe the data. For example, in **JSON** and **XML**, the tags or keys help to organize and label the data, making it easier to understand.
|
| 1401 |
+
""")
|
| 1402 |
st.write("Semi-Structured Data includes formats like CSV, JSON, XML, and HTML.")
|
| 1403 |
|
| 1404 |
+
# JSON Data
|
| 1405 |
+
json_data = {
|
| 1406 |
+
"Name": "Hari",
|
| 1407 |
+
"City": "Hyderabad",
|
| 1408 |
+
"Marks": 90
|
| 1409 |
+
}
|
| 1410 |
+
|
| 1411 |
+
# XML Data as a string
|
| 1412 |
+
xml_data = """
|
| 1413 |
+
<student>
|
| 1414 |
+
<name>Hari</name>
|
| 1415 |
+
<city>Hyderabad</city>
|
| 1416 |
+
<marks>90</marks>
|
| 1417 |
+
</student>
|
| 1418 |
+
"""
|
| 1419 |
+
html_data = """
|
| 1420 |
+
<html>
|
| 1421 |
+
<head><title>Student Info</title></head>
|
| 1422 |
+
<body>
|
| 1423 |
+
<h1>Details of Students</h1>
|
| 1424 |
+
<table border="1">
|
| 1425 |
+
<tr><th>Name</th><th>City</th><th>Marks</th></tr>
|
| 1426 |
+
<tr><td>Hari</td><td>Hyderabad</td><td>90</td></tr>
|
| 1427 |
+
<tr><td>Harika</td><td>Bangalore</td><td>87</td></tr>
|
| 1428 |
+
<tr><td>Varshi</td><td>Chennai</td><td>98</td></tr>
|
| 1429 |
+
<tr><td>Shamitha</td><td>Mumbai</td><td>94</td></tr>
|
| 1430 |
+
</table>
|
| 1431 |
+
</body>
|
| 1432 |
+
</html>
|
| 1433 |
+
"""
|
| 1434 |
+
|
| 1435 |
+
# Display JSON
|
| 1436 |
+
st.subheader("JSON Data:")
|
| 1437 |
+
st.json(json_data)
|
| 1438 |
+
|
| 1439 |
+
# Display XML
|
| 1440 |
+
st.subheader("XML Data:")
|
| 1441 |
+
st.code(xml_data, language='xml')
|
| 1442 |
+
# Display HTML (rendered as HTML)
|
| 1443 |
+
st.subheader("HTML Data:")
|
| 1444 |
+
st.markdown(html_data, unsafe_allow_html=True)
|
| 1445 |
+
|
| 1446 |
+
|
| 1447 |
if st.button("CSV"):
|
| 1448 |
st.session_state['page'] = "csv"
|
| 1449 |
if st.button("JSON"):
|
|
|
|
| 1468 |
|
| 1469 |
st.write("Unstructured Data includes formats like Images and Videos.")
|
| 1470 |
|
| 1471 |
+
|
| 1472 |
+
# Image Definition
|
| 1473 |
+
st.subheader("What is an Image?")
|
| 1474 |
+
st.markdown("""
|
| 1475 |
+
An image is a visual representation, such as a photo or picture, made up of pixels. It captures information visually and can be in various formats like JPEG, PNG, or HEIC.
|
| 1476 |
+
""")
|
| 1477 |
+
|
| 1478 |
+
# Image Formats
|
| 1479 |
+
st.subheader("Image Formats:")
|
| 1480 |
+
st.markdown("""
|
| 1481 |
+
1. **JPEG (.jpg)**: Common for photos; uses lossy compression to reduce file size but loses some quality.
|
| 1482 |
+
2. **JPEG 2000 (.jp2)**: Improved version of JPEG with better compression and quality, but not widely supported.
|
| 1483 |
+
3. **HEIC (.heic)**: High-efficiency format, used on iPhones; offers better compression than JPEG without losing quality.
|
| 1484 |
+
4. **PNG (.png)**: Lossless compression; supports transparency, ideal for images like logos or icons.
|
| 1485 |
+
""")
|
| 1486 |
+
|
| 1487 |
+
# Video Definition
|
| 1488 |
+
st.subheader("What is a Video?")
|
| 1489 |
+
st.markdown("""
|
| 1490 |
+
A video is a sequence of moving images, often with sound, that creates the illusion of motion. It is used for entertainment, information, and communication, commonly in formats like MP4.
|
| 1491 |
+
""")
|
| 1492 |
+
|
| 1493 |
+
# Video Format
|
| 1494 |
+
st.subheader("Video Format:")
|
| 1495 |
+
st.markdown("""
|
| 1496 |
+
1. **MP4 (.mp4)**: Widely used for videos; supports good quality and small file size. It’s compatible with most devices and platforms.
|
| 1497 |
+
""")
|
| 1498 |
+
|
| 1499 |
if st.button("Image"):
|
| 1500 |
st.session_state['page'] = "image"
|
| 1501 |
if st.button("Video"):
|