Skip to content

Commit

Permalink
fix: dependency move streamlit import inline (#620)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArslanSaleem authored Oct 5, 2023
1 parent 66ad87e commit 7587d26
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pandasai/responses/streamlit_response.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
from pandasai.responses.response_parser import ResponseParser

try:
import streamlit as st
except ImportError:
raise ImportError(
"The 'streamlit' module is required but not installed. "
"Please install it using pip: pip install streamlit"
)


class StreamlitResponse(ResponseParser):
def __init__(self, context):
Expand All @@ -30,6 +22,14 @@ def format_plot(self, result) -> None:
except OSError:
raise ValueError(f"The file {result['value']} is not a valid image file.")

try:
import streamlit as st
except ImportError:
raise ImportError(
"The 'streamlit' module is required to use StreamLit Response. "
"Please install it using pip: pip install streamlit"
)

# Display the image
plt.imshow(image)
fig = plt.gcf()
Expand Down

0 comments on commit 7587d26

Please sign in to comment.