Spaces:
Sleeping
Sleeping
khaledeng15
commited on
Commit
Β·
8343c4a
1
Parent(s):
98ed57d
add st_pages
Browse files- .streamlit/pages_sections.toml +24 -0
- CMD.md +1 -1
- pages/text-genration.py β __init__.py +0 -0
- app.py +8 -17
- home.py +19 -0
- {pages β webpages}/blip-image-captioning.py +15 -7
- {pages β webpages}/noon.py +0 -0
- webpages/text-genration.py +0 -0
.streamlit/pages_sections.toml
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[[pages]]
|
2 |
+
path = "home.py"
|
3 |
+
name = "Home"
|
4 |
+
icon = "π "
|
5 |
+
|
6 |
+
[[pages]]
|
7 |
+
name = "Computer Vision"
|
8 |
+
icon = "π"
|
9 |
+
is_section = true
|
10 |
+
|
11 |
+
[[pages]]
|
12 |
+
path = "webpages/blip-image-captioning.py"
|
13 |
+
name = "Find out what in the photo"
|
14 |
+
icon = "π"
|
15 |
+
|
16 |
+
[[pages]]
|
17 |
+
name = "Natural Language Processing"
|
18 |
+
icon = "π"
|
19 |
+
is_section = true
|
20 |
+
|
21 |
+
[[pages]]
|
22 |
+
path = "webpages/text-genration.py"
|
23 |
+
name = "Text Generation"
|
24 |
+
icon = "π"
|
CMD.md
CHANGED
@@ -1 +1 @@
|
|
1 |
-
streamlit run
|
|
|
1 |
+
streamlit run app.py
|
pages/text-genration.py β __init__.py
RENAMED
File without changes
|
app.py
CHANGED
@@ -1,22 +1,13 @@
|
|
1 |
import streamlit as st
|
2 |
-
|
3 |
-
st.set_page_config(
|
4 |
-
page_title="Hello",
|
5 |
-
page_icon="π",
|
6 |
-
)
|
7 |
-
|
8 |
-
st.write("# Welcome to Khaled Space! π")
|
9 |
|
10 |
|
|
|
|
|
|
|
|
|
11 |
|
12 |
-
st.
|
13 |
-
"""
|
14 |
-
Welcome to **Khaled's AI Learning Hub**! π
|
15 |
-
|
16 |
-
This platform is dedicated to showcasing AI development projects, all designed to help you explore and understand the power of artificial intelligence. π€π‘
|
17 |
-
|
18 |
-
**π Select a project from the sidebar** to see hands-on examples ranging from data processing to model deployment. Each project page will guide you through different aspects of AI development, helping you gain practical insights.
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
)
|
|
|
1 |
import streamlit as st
|
2 |
+
from st_pages import add_page_title, get_nav_from_toml
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
|
5 |
+
|
6 |
+
nav = get_nav_from_toml(
|
7 |
+
".streamlit/pages_sections.toml"
|
8 |
+
)
|
9 |
|
10 |
+
pg = st.navigation(nav)
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
+
add_page_title(pg)
|
13 |
+
pg.run()
|
|
home.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
|
4 |
+
|
5 |
+
st.write("# Welcome to Khaled Space! π")
|
6 |
+
|
7 |
+
|
8 |
+
|
9 |
+
st.markdown(
|
10 |
+
"""
|
11 |
+
Welcome to **Khaled's AI Learning Hub**! π
|
12 |
+
|
13 |
+
This platform is dedicated to showcasing AI development projects, all designed to help you explore and understand the power of artificial intelligence. π€π‘
|
14 |
+
|
15 |
+
**π Select a project from the sidebar** to see hands-on examples ranging from data processing to model deployment. Each project page will guide you through different aspects of AI development, helping you gain practical insights.
|
16 |
+
|
17 |
+
|
18 |
+
"""
|
19 |
+
)
|
{pages β webpages}/blip-image-captioning.py
RENAMED
@@ -8,9 +8,14 @@ from transformers import pipeline
|
|
8 |
|
9 |
from helper.image_helper import to_base64
|
10 |
|
|
|
|
|
|
|
11 |
pipe = pipeline("image-to-text",
|
12 |
model="Salesforce/blip-image-captioning-base")
|
13 |
|
|
|
|
|
14 |
def process_file():
|
15 |
stringio = StringIO(uploaded_file.getvalue().decode("utf-8"))
|
16 |
txt = launch(stringio)
|
@@ -25,18 +30,21 @@ def launch(input):
|
|
25 |
|
26 |
uploaded_file = st.file_uploader("Choose a file")
|
27 |
if uploaded_file is not None:
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
31 |
# bytes_data = uploaded_file.getvalue()
|
32 |
-
base64 = to_base64(uploaded_file)
|
33 |
-
st.image(base64)
|
34 |
|
35 |
-
txt = launch(
|
36 |
st.write(txt)
|
37 |
|
38 |
# iface = gr.Interface(launch,
|
39 |
# inputs=gr.Image(type='pil'),
|
40 |
# outputs="text")
|
41 |
|
42 |
-
# iface.launch()
|
|
|
|
|
|
8 |
|
9 |
from helper.image_helper import to_base64
|
10 |
|
11 |
+
|
12 |
+
|
13 |
+
|
14 |
pipe = pipeline("image-to-text",
|
15 |
model="Salesforce/blip-image-captioning-base")
|
16 |
|
17 |
+
img= None
|
18 |
+
|
19 |
def process_file():
|
20 |
stringio = StringIO(uploaded_file.getvalue().decode("utf-8"))
|
21 |
txt = launch(stringio)
|
|
|
30 |
|
31 |
uploaded_file = st.file_uploader("Choose a file")
|
32 |
if uploaded_file is not None:
|
33 |
+
|
34 |
+
img = Image.open(uploaded_file)
|
35 |
+
st.image(img)
|
36 |
+
|
37 |
# bytes_data = uploaded_file.getvalue()
|
38 |
+
# base64 = to_base64(uploaded_file)
|
39 |
+
# st.image(base64)
|
40 |
|
41 |
+
txt = launch(img)
|
42 |
st.write(txt)
|
43 |
|
44 |
# iface = gr.Interface(launch,
|
45 |
# inputs=gr.Image(type='pil'),
|
46 |
# outputs="text")
|
47 |
|
48 |
+
# iface.launch()
|
49 |
+
|
50 |
+
|
{pages β webpages}/noon.py
RENAMED
File without changes
|
webpages/text-genration.py
ADDED
File without changes
|