Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ import gdown
|
|
| 6 |
import zipfile
|
| 7 |
|
| 8 |
# Cache the model loading
|
| 9 |
-
@st.
|
| 10 |
def load_model():
|
| 11 |
# The shareable link to your Google Drive file
|
| 12 |
url = "https://drive.google.com/uc?id=1m9YVs0cBRT3-j98rn7d_0DT7jwB_EXPu"
|
|
@@ -20,7 +20,7 @@ def load_model():
|
|
| 20 |
return model
|
| 21 |
|
| 22 |
# Cache the JSON data loading
|
| 23 |
-
@st.
|
| 24 |
def load_json(filename):
|
| 25 |
with open(filename, 'r') as f:
|
| 26 |
return json.load(f)
|
|
@@ -39,6 +39,9 @@ def predict_rating(reviewerID, itemID, model):
|
|
| 39 |
itemAvgRating = item_attributes.get('itemAvgRating', 4)
|
| 40 |
review_time = user_attributes.get('unixReviewTime', 1285579290)
|
| 41 |
|
|
|
|
|
|
|
|
|
|
| 42 |
prediction_inputs = {
|
| 43 |
'reviewer_id': np.array([reviewerID], dtype=np.int32),
|
| 44 |
'item_id': np.array([itemID], dtype=np.int32),
|
|
|
|
| 6 |
import zipfile
|
| 7 |
|
| 8 |
# Cache the model loading
|
| 9 |
+
@st.cache_data(allow_output_mutation=True)
|
| 10 |
def load_model():
|
| 11 |
# The shareable link to your Google Drive file
|
| 12 |
url = "https://drive.google.com/uc?id=1m9YVs0cBRT3-j98rn7d_0DT7jwB_EXPu"
|
|
|
|
| 20 |
return model
|
| 21 |
|
| 22 |
# Cache the JSON data loading
|
| 23 |
+
@st.cache_data(allow_output_mutation=True)
|
| 24 |
def load_json(filename):
|
| 25 |
with open(filename, 'r') as f:
|
| 26 |
return json.load(f)
|
|
|
|
| 39 |
itemAvgRating = item_attributes.get('itemAvgRating', 4)
|
| 40 |
review_time = user_attributes.get('unixReviewTime', 1285579290)
|
| 41 |
|
| 42 |
+
reviewText_placeholder = ""
|
| 43 |
+
summary_placeholder = ""
|
| 44 |
+
|
| 45 |
prediction_inputs = {
|
| 46 |
'reviewer_id': np.array([reviewerID], dtype=np.int32),
|
| 47 |
'item_id': np.array([itemID], dtype=np.int32),
|