Rajarshi Roy commited on
Commit
c72bb1d
·
verified ·
1 Parent(s): 6b26b31

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -0
app.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import plotly.io as pio
3
+ from google.colab import files
4
+
5
+ # List of plot names
6
+ plot_list = [
7
+ "Web_Context VS AI generated story_temp_0.2",
8
+ "RAG_context VS AI generated story_temp_0.2",
9
+ "Human story fetched VS AI generated story_temp_0.2",
10
+ "Gemma2_9b"
11
+ ]
12
+
13
+ # Function to save Plotly figure to JSON file
14
+ def save_plotly_figures():
15
+ for plot_name in plot_list:
16
+ # Load the figure (assuming you have these figures in the current environment)
17
+ fig = pio.read_json(f'{plot_name}.json')
18
+
19
+ # Save the figure to a JSON file
20
+ json_filename = f'{plot_name}.json'
21
+ with open(json_filename, 'w') as f:
22
+ json.dump(fig.to_dict(), f)
23
+
24
+ # Download the file
25
+ files.download(json_filename)
26
+
27
+ # Call the function to save and download figures
28
+ save_plotly_figures()