Commit
·
37ddc9f
1
Parent(s):
e5261b7
update: annotation app
Browse files- src/streamlit_app.py +13 -1
src/streamlit_app.py
CHANGED
@@ -1,7 +1,8 @@
|
|
|
|
1 |
import streamlit as st
|
2 |
import fitz
|
3 |
from PIL import Image
|
4 |
-
import
|
5 |
from streamlit_cropper import st_cropper
|
6 |
|
7 |
|
@@ -70,3 +71,14 @@ if uploaded_pdf:
|
|
70 |
print(f"{len(st.session_state.cropped_images)=}")
|
71 |
print(f"{st.session_state.cropped_images[-1].size=}")
|
72 |
print(f"{st.session_state.captions[-1]=}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import io
|
2 |
import streamlit as st
|
3 |
import fitz
|
4 |
from PIL import Image
|
5 |
+
from datasets import Dataset
|
6 |
from streamlit_cropper import st_cropper
|
7 |
|
8 |
|
|
|
71 |
print(f"{len(st.session_state.cropped_images)=}")
|
72 |
print(f"{st.session_state.cropped_images[-1].size=}")
|
73 |
print(f"{st.session_state.captions[-1]=}")
|
74 |
+
|
75 |
+
huggingface_dataset_address = st.sidebar.text_input("Hugging Face Dataset Address")
|
76 |
+
if st.sidebar.button("Save to HuggingFace"):
|
77 |
+
dataset = Dataset.from_dict(
|
78 |
+
{
|
79 |
+
"image": st.session_state.cropped_images,
|
80 |
+
"caption": st.session_state.captions,
|
81 |
+
},
|
82 |
+
)
|
83 |
+
dataset.push_to_hub(huggingface_dataset_address)
|
84 |
+
st.success("Dataset saved to Hugging Face")
|