chanicpanic commited on
Commit
f7fafc2
·
1 Parent(s): d805d95

Disable image saving

Browse files
Files changed (2) hide show
  1. save_image.py +17 -17
  2. search.py +7 -7
save_image.py CHANGED
@@ -4,20 +4,20 @@ from datetime import datetime, timezone
4
  from scheduler import ParquetScheduler
5
 
6
 
7
- scheduler = ParquetScheduler(
8
- repo_id=st.secrets.IMAGES_REPO,
9
- token=st.secrets.HF_TOKEN,
10
- every=15,
11
- )
12
-
13
-
14
- @st.cache_data(ttl=3600)
15
- def save_image(data, prediction):
16
- scheduler.append(
17
- {
18
- "date": datetime.now(timezone.utc).date(),
19
- "image": data,
20
- "prediction": prediction,
21
- "sha256": sha256(data).hexdigest(),
22
- }
23
- )
 
4
  from scheduler import ParquetScheduler
5
 
6
 
7
+ # scheduler = ParquetScheduler(
8
+ # repo_id=st.secrets.IMAGES_REPO,
9
+ # token=st.secrets.HF_TOKEN,
10
+ # every=15,
11
+ # )
12
+ #
13
+ #
14
+ # @st.cache_data(ttl=3600)
15
+ # def save_image(data, prediction):
16
+ # scheduler.append(
17
+ # {
18
+ # "date": datetime.now(timezone.utc).date(),
19
+ # "image": data,
20
+ # "prediction": prediction,
21
+ # "sha256": sha256(data).hexdigest(),
22
+ # }
23
+ # )
search.py CHANGED
@@ -8,7 +8,7 @@ from datasets import load_dataset
8
  from grascii import GrasciiSearcher, InvalidGrascii, ReverseSearcher
9
  from report import report_dialog
10
  from vision import run_vision
11
- from save_image import save_image
12
 
13
 
14
  MAX_GRASCII_LENGTH = 16
@@ -70,10 +70,10 @@ def write_grascii_search():
70
  - that does not contain marks beside the shorthand form
71
  """,
72
  )
73
- save = st.checkbox(
74
- "Save images I upload for potential inclusion in open-source datasets used to train and improve models",
75
- key="save_image",
76
- )
77
 
78
  if image_data:
79
  image = Image.open(image_data).convert("RGBA")
@@ -87,8 +87,8 @@ def write_grascii_search():
87
  st.session_state["alternatives"] = alternatives
88
  st.session_state["grascii"] = "".join(predictions[0])
89
 
90
- if save:
91
- save_image(image_data.getvalue(), "-".join(predictions[0]))
92
 
93
  with st.expander("Options"):
94
  interpretation = st.radio(
 
8
  from grascii import GrasciiSearcher, InvalidGrascii, ReverseSearcher
9
  from report import report_dialog
10
  from vision import run_vision
11
+ # from save_image import save_image
12
 
13
 
14
  MAX_GRASCII_LENGTH = 16
 
70
  - that does not contain marks beside the shorthand form
71
  """,
72
  )
73
+ # save = st.checkbox(
74
+ # "Save images I upload for potential inclusion in open-source datasets used to train and improve models",
75
+ # key="save_image",
76
+ # )
77
 
78
  if image_data:
79
  image = Image.open(image_data).convert("RGBA")
 
87
  st.session_state["alternatives"] = alternatives
88
  st.session_state["grascii"] = "".join(predictions[0])
89
 
90
+ # if save:
91
+ # save_image(image_data.getvalue(), "-".join(predictions[0]))
92
 
93
  with st.expander("Options"):
94
  interpretation = st.radio(