Spaces:
Sleeping
Sleeping
Update backup1.app.py
Browse files- backup1.app.py +33 -67
backup1.app.py
CHANGED
@@ -2,73 +2,10 @@ import streamlit as st
|
|
2 |
import os
|
3 |
from PIL import Image
|
4 |
|
5 |
-
# Placeholder function for Wikipedia content fetching
|
6 |
-
# You'll need to replace this with actual fetching logic
|
7 |
-
def fetch_wikipedia_summary(keyword):
|
8 |
-
# Placeholder text, replace with actual Wikipedia fetching logic
|
9 |
-
return f"Summary about {keyword} from Wikipedia."
|
10 |
-
|
11 |
-
# Display images from the current directory and fetch related Wikipedia stories
|
12 |
-
def display_images_and_wikipedia_summaries():
|
13 |
-
st.title('Gallery with Related Stories')
|
14 |
-
|
15 |
-
# Scan current directory for PNG images
|
16 |
-
image_files = [f for f in os.listdir('.') if f.endswith('.png')]
|
17 |
-
|
18 |
-
# Check if there are any PNG images
|
19 |
-
if not image_files:
|
20 |
-
st.write("No PNG images found in the current directory.")
|
21 |
-
return
|
22 |
-
|
23 |
-
# Iterate over found images
|
24 |
-
for image_file in image_files:
|
25 |
-
# Open and display each image
|
26 |
-
image = Image.open(image_file)
|
27 |
-
st.image(image, caption=image_file, use_column_width='always')
|
28 |
-
|
29 |
-
# Extract a keyword from the image file name for Wikipedia search
|
30 |
-
# This is a simple example; adjust logic as needed for more complex titles
|
31 |
-
keyword = image_file.split('.')[0] # Assumes keyword is the file name without extension
|
32 |
-
|
33 |
-
# Fetch and display related Wikipedia content
|
34 |
-
wikipedia_summary = fetch_wikipedia_summary(keyword)
|
35 |
-
st.write(wikipedia_summary)
|
36 |
-
|
37 |
-
# Call the function to display images and summaries
|
38 |
-
display_images_and_wikipedia_summaries()
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
import streamlit as st
|
43 |
-
st.markdown('# Three Dragons 🐉🌍 Mythical Dragons Around the World by Aaron Wacker')
|
44 |
-
|
45 |
-
dragons = {
|
46 |
-
'#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.',
|
47 |
-
'#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.',
|
48 |
-
'#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.'
|
49 |
-
}
|
50 |
-
|
51 |
-
for dragon, story in dragons.items():
|
52 |
-
st.subheader(dragon)
|
53 |
-
st.markdown(f"- {story}")
|
54 |
-
|
55 |
-
|
56 |
st.markdown('''
|
57 |
-
|
58 |
-
![image/png](https://cdn-uploads.huggingface.co/production/uploads/620630b603825909dcbeba35/vkNh6XnEtGSj8mXea1W6p.png)
|
59 |
-
![image/png](https://cdn-uploads.huggingface.co/production/uploads/620630b603825909dcbeba35/Kr_nqtaglHE_aiFxWH9zF.png)
|
60 |
-
![image/png](https://cdn-uploads.huggingface.co/production/uploads/620630b603825909dcbeba35/WLRKWqB6dKlMH6saVV9cX.png)
|
61 |
-
![image/png](https://cdn-uploads.huggingface.co/production/uploads/620630b603825909dcbeba35/Lyazf6FuX4nH__4illVki.png)
|
62 |
-
![image/png](https://cdn-uploads.huggingface.co/production/uploads/620630b603825909dcbeba35/ZemsxlT3b5idB0W5IjL1o.png)
|
63 |
''')
|
64 |
|
65 |
-
|
66 |
-
|
67 |
-
st.markdown('''
|
68 |
-
# Remixable!!
|
69 |
-
## Classifications''')
|
70 |
-
|
71 |
-
# Create three columns for Inputs, Outputs, and Health
|
72 |
col1, col2, col3 = st.columns(3)
|
73 |
|
74 |
with col1:
|
@@ -106,7 +43,6 @@ with col3:
|
|
106 |
st.button("🌡️ Temperature")
|
107 |
st.button("🍏 Nutrition")
|
108 |
|
109 |
-
# Create another set of three columns for Learning, AI, and Writing
|
110 |
col4, col5, col6 = st.columns(3)
|
111 |
|
112 |
with col4:
|
@@ -147,6 +83,36 @@ with col6:
|
|
147 |
st.button("✒️ Ink")
|
148 |
st.button("📜 Scroll")
|
149 |
|
150 |
-
|
151 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
import os
|
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 |
+
![image/png](https://cdn-uploads.huggingface.co/production/uploads/620630b603825909dcbeba35/vkNh6XnEtGSj8mXea1W6p.png)
|
114 |
+
![image/png](https://cdn-uploads.huggingface.co/production/uploads/620630b603825909dcbeba35/Kr_nqtaglHE_aiFxWH9zF.png)
|
115 |
+
![image/png](https://cdn-uploads.huggingface.co/production/uploads/620630b603825909dcbeba35/WLRKWqB6dKlMH6saVV9cX.png)
|
116 |
+
![image/png](https://cdn-uploads.huggingface.co/production/uploads/620630b603825909dcbeba35/Lyazf6FuX4nH__4illVki.png)
|
117 |
+
![image/png](https://cdn-uploads.huggingface.co/production/uploads/620630b603825909dcbeba35/ZemsxlT3b5idB0W5IjL1o.png)
|
118 |
+
''')
|