zaursamedov1 commited on
Commit
929c1b9
·
verified ·
1 Parent(s): ae731c4

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +22 -6
app.py CHANGED
@@ -4,14 +4,30 @@ import plotly.graph_objects as go
4
  import gradio as gr
5
  import os
6
 
7
- # Get the current directory
8
- current_dir = os.path.dirname(os.path.abspath(__file__))
 
9
 
10
- # Construct the file path
11
- file_path = os.path.join(current_dir, 'INSTITUTIONAL_INVESTORS_SCORE.csv')
 
 
 
 
 
12
 
13
- # Load the data
14
- df = pd.read_csv(file_path)
 
 
 
 
 
 
 
 
 
 
15
 
16
  # Clean the data
17
  df = df.dropna(subset=['final_score'])
 
4
  import gradio as gr
5
  import os
6
 
7
+ # Debugging information
8
+ print("Current working directory:", os.getcwd())
9
+ print("Contents of current directory:", os.listdir())
10
 
11
+ # Try multiple possible locations for the CSV file
12
+ possible_locations = [
13
+ 'INSTITUTIONAL_INVESTORS_SCORE.csv',
14
+ '/home/user/app/INSTITUTIONAL_INVESTORS_SCORE.csv',
15
+ '/content/INSTITUTIONAL_INVESTORS_SCORE.csv',
16
+ os.path.join(os.getcwd(), 'INSTITUTIONAL_INVESTORS_SCORE.csv')
17
+ ]
18
 
19
+ df = None
20
+ for location in possible_locations:
21
+ try:
22
+ print(f"Trying to read from: {location}")
23
+ df = pd.read_csv(location)
24
+ print(f"Successfully read from: {location}")
25
+ break
26
+ except FileNotFoundError:
27
+ print(f"File not found at: {location}")
28
+
29
+ if df is None:
30
+ raise FileNotFoundError("Could not find the CSV file in any of the expected locations.")
31
 
32
  # Clean the data
33
  df = df.dropna(subset=['final_score'])