iisadia commited on
Commit
9ee5559
Β·
verified Β·
1 Parent(s): 25d8309

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -25
app.py CHANGED
@@ -65,35 +65,23 @@ st.markdown("""
65
 
66
  @st.cache_resource
67
  def load_movie_data():
68
- # Option 1: Try loading with trust_remote_code
69
  try:
70
- dataset = load_dataset(
71
- "eraser-benchmark/movie_rationales",
72
- split="train[:2000]",
73
- trust_remote_code=True # Explicitly allow trusted code
74
- )
75
- print(dataset.column_names)
76
  df = pd.DataFrame(dataset)
77
- df['context'] = "Title: " + df['movie'] + "\n" + \
78
- "Plot: " + df['plot'] + "\n" + \
79
- "Year: " + df['year'].astype(str)
 
 
 
80
  return df
81
-
82
  except Exception as e:
83
- # Option 2: Fallback to synthetic data
84
- st.warning("Using high-quality synthetic movie data")
85
- st.error(f"Dataset loading failed: {str(e)}")
86
- return pd.DataFrame([
87
- {
88
- "context": "Title: The Dark Knight\nPlot: Batman faces the Joker...\nYear: 2008\nCast: Christian Bale, Heath Ledger\nDirector: Christopher Nolan"
89
- },
90
- {
91
- "context": "Title: Inception\nPlot: A thief who enters dreams...\nYear: 2010\nCast: Leonardo DiCaprio\nDirector: Christopher Nolan"
92
- },
93
- {
94
- "context": "Title: Pulp Fiction\nPlot: Interconnected stories of criminals...\nYear: 1994\nCast: John Travolta\nDirector: Quentin Tarantino"
95
- }
96
- ])
97
 
98
 
99
  @st.cache_resource
 
65
 
66
  @st.cache_resource
67
  def load_movie_data():
 
68
  try:
69
+ st.write("πŸ”„ Attempting to load dataset...")
70
+
71
+ dataset = load_dataset("eraser-benchmark/movie_rationales", split="train[:5]", trust_remote_code=True)
 
 
 
72
  df = pd.DataFrame(dataset)
73
+
74
+ st.write("βœ… Columns in dataset:")
75
+ st.write(df.columns.tolist())
76
+ st.write("πŸ“„ Sample row:")
77
+ st.write(df.iloc[0])
78
+
79
  return df
80
+
81
  except Exception as e:
82
+ st.error(f"❌ Dataset loading failed: {str(e)}")
83
+ return pd.DataFrame()
84
+
 
 
 
 
 
 
 
 
 
 
 
85
 
86
 
87
  @st.cache_resource