Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,8 @@ import os
|
|
6 |
import pandas as pd
|
7 |
from io import StringIO, BytesIO
|
8 |
import base64
|
|
|
|
|
9 |
# from linePlot import plot_stacked_time_series, plot_emotion_topic_grid
|
10 |
|
11 |
# Define your Hugging Face token (make sure to set it as an environment variable)
|
@@ -37,14 +39,12 @@ def stream_chat_with_rag(
|
|
37 |
print("top works from API:")
|
38 |
print(fig)
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
# return answer, fig
|
47 |
-
return answe, plt.gcf()
|
48 |
|
49 |
|
50 |
|
|
|
6 |
import pandas as pd
|
7 |
from io import StringIO, BytesIO
|
8 |
import base64
|
9 |
+
import json
|
10 |
+
import plotly.io as pio
|
11 |
# from linePlot import plot_stacked_time_series, plot_emotion_topic_grid
|
12 |
|
13 |
# Define your Hugging Face token (make sure to set it as an environment variable)
|
|
|
39 |
print("top works from API:")
|
40 |
print(fig)
|
41 |
|
42 |
+
fig_dict = json.loads(plotly_data['plot'])
|
43 |
+
|
44 |
+
# Render the figure
|
45 |
+
fig = pio.from_json(json.dumps(fig_dict))
|
46 |
+
fig.show()
|
47 |
+
return answe, fig
|
|
|
|
|
48 |
|
49 |
|
50 |
|