Update app.py
Browse files
app.py
CHANGED
@@ -2,9 +2,7 @@ import gradio as gr
|
|
2 |
import pandas as pd
|
3 |
import matplotlib.pyplot as plt
|
4 |
import io
|
5 |
-
import base64
|
6 |
import google.generativeai as genai
|
7 |
-
import textwrap
|
8 |
|
9 |
def process_file(api_key, file, instructions):
|
10 |
# Set up Gemini API
|
@@ -65,10 +63,9 @@ def process_file(api_key, file, instructions):
|
|
65 |
buf = io.BytesIO()
|
66 |
plt.savefig(buf, format='png')
|
67 |
buf.seek(0)
|
68 |
-
img_str = base64.b64encode(buf.getvalue()).decode()
|
69 |
plt.close()
|
70 |
|
71 |
-
visualizations.append(
|
72 |
except Exception as e:
|
73 |
print(f"Error in visualization {i}: {str(e)}")
|
74 |
visualizations.append(None)
|
|
|
2 |
import pandas as pd
|
3 |
import matplotlib.pyplot as plt
|
4 |
import io
|
|
|
5 |
import google.generativeai as genai
|
|
|
6 |
|
7 |
def process_file(api_key, file, instructions):
|
8 |
# Set up Gemini API
|
|
|
63 |
buf = io.BytesIO()
|
64 |
plt.savefig(buf, format='png')
|
65 |
buf.seek(0)
|
|
|
66 |
plt.close()
|
67 |
|
68 |
+
visualizations.append(buf)
|
69 |
except Exception as e:
|
70 |
print(f"Error in visualization {i}: {str(e)}")
|
71 |
visualizations.append(None)
|