Vera-ZWY commited on
Commit
1cf4aa1
·
verified ·
1 Parent(s): 4bc7cb3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -3,7 +3,7 @@ from gradio_client import Client, handle_file
3
  import seaborn as sns
4
  import matplotlib.pyplot as plt
5
  import os
6
-
7
 
8
  # Define your Hugging Face token (make sure to set it as an environment variable)
9
  HF_TOKEN = os.getenv("HF_TOKEN") # Replace with your actual token if not using an environment variable
@@ -47,9 +47,11 @@ def heatmap(top_n):
47
  )
48
  print(pivot_table)
49
  print(type(pivot_table))
 
 
50
 
51
  plt.figure(figsize=(10, 8))
52
- sns.heatmap(pivot_table,
53
  cmap='YlOrRd',
54
  cbar_kws={'label': 'Weighted Frequency'},
55
  square=True)
 
3
  import seaborn as sns
4
  import matplotlib.pyplot as plt
5
  import os
6
+ import pandas as pd
7
 
8
  # Define your Hugging Face token (make sure to set it as an environment variable)
9
  HF_TOKEN = os.getenv("HF_TOKEN") # Replace with your actual token if not using an environment variable
 
47
  )
48
  print(pivot_table)
49
  print(type(pivot_table))
50
+
51
+ df = pd.read_csv(StringIO(pivot_table), delim_whitespace=True, index_col=0)
52
 
53
  plt.figure(figsize=(10, 8))
54
+ sns.heatmap(df,
55
  cmap='YlOrRd',
56
  cbar_kws={'label': 'Weighted Frequency'},
57
  square=True)