daranaka commited on
Commit
06d0589
1 Parent(s): cb772ac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -5,11 +5,7 @@ import torch
5
  import numpy as np
6
  import urllib.request
7
 
8
- # Initialize session state for memory if not already
9
- if "memory" not in st.session_state:
10
- st.session_state.memory = {"characters": {}, "transcript": ""}
11
-
12
- @st.cache_resource
13
  def load_model():
14
  model = AutoModel.from_pretrained("ragavsachdeva/magi", trust_remote_code=True)
15
  device = "cuda" if torch.cuda.is_available() else "cpu"
@@ -24,6 +20,8 @@ def read_image_as_np_array(image_path):
24
  image = Image.open(image_path).convert("L").convert("RGB")
25
  image = np.array(image)
26
  return image
 
 
27
 
28
  @st.cache_data
29
  def predict_detections_and_associations(
 
5
  import numpy as np
6
  import urllib.request
7
 
8
+ # Load model without caching due to serialization issue with PretrainedConfig
 
 
 
 
9
  def load_model():
10
  model = AutoModel.from_pretrained("ragavsachdeva/magi", trust_remote_code=True)
11
  device = "cuda" if torch.cuda.is_available() else "cpu"
 
20
  image = Image.open(image_path).convert("L").convert("RGB")
21
  image = np.array(image)
22
  return image
23
+
24
+ model = load_model()
25
 
26
  @st.cache_data
27
  def predict_detections_and_associations(