Francesco commited on
Commit
741deae
1 Parent(s): d33f75e

added storage env var

Browse files
Files changed (2) hide show
  1. README.md +2 -0
  2. app.py +7 -6
README.md CHANGED
@@ -50,6 +50,8 @@ UPSTASH_URL=<UPSTASH_URL>
50
  UPSTASH_PASSWORD=<UPSTASH_PASSWORD>
51
  ```
52
 
 
 
53
  Then
54
 
55
  ```
 
50
  UPSTASH_PASSWORD=<UPSTASH_PASSWORD>
51
  ```
52
 
53
+ If you **don't want to use upstash** set the `USE_STORAGE=False`
54
+
55
  Then
56
 
57
  ```
app.py CHANGED
@@ -28,6 +28,7 @@ class RetrievalType:
28
 
29
 
30
  Matches = List[Tuple[Document, float]]
 
31
 
32
 
33
  @st.cache_resource
@@ -166,12 +167,12 @@ def set_song(user_input):
166
  unsafe_allow_html=True,
167
  )
168
 
169
- success_storage = storage.store(
170
- UserInput(text=user_input, emotions=emotions, songs=songs)
171
- )
172
- if not success_storage:
173
- print("[ERROR] was not able to store user_input")
174
-
175
 
176
  if run_btn:
177
  set_song(text_input)
 
28
 
29
 
30
  Matches = List[Tuple[Document, float]]
31
+ USE_STORAGE = os.getenv("USE_STORAGE", "False").lower() in ("true", "1", "t")
32
 
33
 
34
  @st.cache_resource
 
167
  unsafe_allow_html=True,
168
  )
169
 
170
+ if USE_STORAGE:
171
+ success_storage = storage.store(
172
+ UserInput(text=user_input, emotions=emotions, songs=songs)
173
+ )
174
+ if not success_storage:
175
+ print("[ERROR] was not able to store user_input")
176
 
177
  if run_btn:
178
  set_song(text_input)