Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,10 +3,9 @@ import os
|
|
| 3 |
from PIL import Image
|
| 4 |
|
| 5 |
st.markdown('''
|
| 6 |
-
# Remixable
|
| 7 |
''')
|
| 8 |
|
| 9 |
-
# Create three columns for Inputs, Outputs, and Health
|
| 10 |
col1, col2, col3 = st.columns(3)
|
| 11 |
|
| 12 |
with col1:
|
|
@@ -44,7 +43,6 @@ with col3:
|
|
| 44 |
st.button("🌡️ Temperature")
|
| 45 |
st.button("🍏 Nutrition")
|
| 46 |
|
| 47 |
-
# Create another set of three columns for Learning, AI, and Writing
|
| 48 |
col4, col5, col6 = st.columns(3)
|
| 49 |
|
| 50 |
with col4:
|
|
@@ -85,58 +83,31 @@ with col6:
|
|
| 85 |
st.button("✒️ Ink")
|
| 86 |
st.button("📜 Scroll")
|
| 87 |
|
| 88 |
-
|
| 89 |
-
# Placeholder function for Wikipedia content fetching
|
| 90 |
-
# You'll need to replace this with actual fetching logic
|
| 91 |
-
def fetch_wikipedia_summary(keyword):
|
| 92 |
-
# Placeholder text, replace with actual Wikipedia fetching logic
|
| 93 |
-
return f"Summary about {keyword} from Wikipedia."
|
| 94 |
-
|
| 95 |
-
# Display images from the current directory and fetch related Wikipedia stories
|
| 96 |
def display_images_and_wikipedia_summaries():
|
| 97 |
st.title('Gallery with Related Stories')
|
| 98 |
-
|
| 99 |
-
# Scan current directory for PNG images
|
| 100 |
image_files = [f for f in os.listdir('.') if f.endswith('.png')]
|
| 101 |
-
|
| 102 |
-
# Check if there are any PNG images
|
| 103 |
if not image_files:
|
| 104 |
st.write("No PNG images found in the current directory.")
|
| 105 |
return
|
| 106 |
-
|
| 107 |
-
# Iterate over found images
|
| 108 |
for image_file in image_files:
|
| 109 |
-
# Open and display each image
|
| 110 |
image = Image.open(image_file)
|
| 111 |
st.image(image, caption=image_file, use_column_width='always')
|
| 112 |
-
|
| 113 |
-
# Extract a keyword from the image file name for Wikipedia search
|
| 114 |
-
# This is a simple example; adjust logic as needed for more complex titles
|
| 115 |
keyword = image_file.split('.')[0] # Assumes keyword is the file name without extension
|
| 116 |
|
| 117 |
-
# Fetch and display related Wikipedia content
|
| 118 |
wikipedia_summary = fetch_wikipedia_summary(keyword)
|
| 119 |
st.write(wikipedia_summary)
|
| 120 |
|
| 121 |
-
# Call the function to display images and summaries
|
| 122 |
display_images_and_wikipedia_summaries()
|
| 123 |
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
import streamlit as st
|
| 127 |
st.markdown('# Three Dragons 🐉🌍 Mythical Dragons Around the World by Aaron Wacker')
|
| 128 |
-
|
| 129 |
dragons = {
|
| 130 |
'#Fafnir #Norse': '- **Story**: Fafnir originally a dwarf, transformed into a fierce dragon due to his greed for the treasure he guarded. He was later slain by the hero Sigurd. - **Significance**: deadly sin of greed and the corrupting power of wealth.',
|
| 131 |
'#Quetzalcoatl #Aztec': '- **Story**: Quetzalcoatl, the Feathered Serpent, is not a dragon in the traditional sense but shares many similarities. He was a deity representing wind, air, and learning. - **Significance**: creator god and a symbol of death and rebirth.',
|
| 132 |
'#Tiamat #Mesopotamian': '- **Story**: Tiamat, primordial goddess of ocean, turned into a dragon-like creature in a battle against her children who threatened her authority. - **Significance**: chaos of primordial creation and is often associated with the forces of nature.'
|
| 133 |
}
|
| 134 |
-
|
| 135 |
for dragon, story in dragons.items():
|
| 136 |
st.subheader(dragon)
|
| 137 |
st.markdown(f"- {story}")
|
| 138 |
-
|
| 139 |
-
|
| 140 |
st.markdown('''
|
| 141 |
https://github.com/AaronCWacker/ThreeDragons
|
| 142 |

|
|
@@ -145,8 +116,3 @@ https://github.com/AaronCWacker/ThreeDragons
|
|
| 145 |

|
| 146 |

|
| 147 |
''')
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
# Similarly, create columns for Coding, Remix, Movies, Video, and Audio as needed
|
| 151 |
-
# You can continue this pattern for organizing the rest of your buttons into columns
|
| 152 |
-
|
|
|
|
| 3 |
from PIL import Image
|
| 4 |
|
| 5 |
st.markdown('''
|
| 6 |
+
# Remixable!
|
| 7 |
''')
|
| 8 |
|
|
|
|
| 9 |
col1, col2, col3 = st.columns(3)
|
| 10 |
|
| 11 |
with col1:
|
|
|
|
| 43 |
st.button("🌡️ Temperature")
|
| 44 |
st.button("🍏 Nutrition")
|
| 45 |
|
|
|
|
| 46 |
col4, col5, col6 = st.columns(3)
|
| 47 |
|
| 48 |
with col4:
|
|
|
|
| 83 |
st.button("✒️ Ink")
|
| 84 |
st.button("📜 Scroll")
|
| 85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
def display_images_and_wikipedia_summaries():
|
| 87 |
st.title('Gallery with Related Stories')
|
|
|
|
|
|
|
| 88 |
image_files = [f for f in os.listdir('.') if f.endswith('.png')]
|
|
|
|
|
|
|
| 89 |
if not image_files:
|
| 90 |
st.write("No PNG images found in the current directory.")
|
| 91 |
return
|
|
|
|
|
|
|
| 92 |
for image_file in image_files:
|
|
|
|
| 93 |
image = Image.open(image_file)
|
| 94 |
st.image(image, caption=image_file, use_column_width='always')
|
|
|
|
|
|
|
|
|
|
| 95 |
keyword = image_file.split('.')[0] # Assumes keyword is the file name without extension
|
| 96 |
|
|
|
|
| 97 |
wikipedia_summary = fetch_wikipedia_summary(keyword)
|
| 98 |
st.write(wikipedia_summary)
|
| 99 |
|
|
|
|
| 100 |
display_images_and_wikipedia_summaries()
|
| 101 |
|
|
|
|
|
|
|
|
|
|
| 102 |
st.markdown('# Three Dragons 🐉🌍 Mythical Dragons Around the World by Aaron Wacker')
|
|
|
|
| 103 |
dragons = {
|
| 104 |
'#Fafnir #Norse': '- **Story**: Fafnir originally a dwarf, transformed into a fierce dragon due to his greed for the treasure he guarded. He was later slain by the hero Sigurd. - **Significance**: deadly sin of greed and the corrupting power of wealth.',
|
| 105 |
'#Quetzalcoatl #Aztec': '- **Story**: Quetzalcoatl, the Feathered Serpent, is not a dragon in the traditional sense but shares many similarities. He was a deity representing wind, air, and learning. - **Significance**: creator god and a symbol of death and rebirth.',
|
| 106 |
'#Tiamat #Mesopotamian': '- **Story**: Tiamat, primordial goddess of ocean, turned into a dragon-like creature in a battle against her children who threatened her authority. - **Significance**: chaos of primordial creation and is often associated with the forces of nature.'
|
| 107 |
}
|
|
|
|
| 108 |
for dragon, story in dragons.items():
|
| 109 |
st.subheader(dragon)
|
| 110 |
st.markdown(f"- {story}")
|
|
|
|
|
|
|
| 111 |
st.markdown('''
|
| 112 |
https://github.com/AaronCWacker/ThreeDragons
|
| 113 |

|
|
|
|
| 116 |

|
| 117 |

|
| 118 |
''')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|