Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent chat() function from downloading images. #1431

Open
aniketwdubey opened this issue Nov 14, 2024 · 0 comments
Open

Prevent chat() function from downloading images. #1431

aniketwdubey opened this issue Nov 14, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@aniketwdubey
Copy link

aniketwdubey commented Nov 14, 2024

Is there a way for the chat() function in the pandasai library to return image responses in a way that they can be displayed directly on a Streamlit app without triggering a download?

I'm currently developing a Streamlit application that utilizes the pandasai library for data analysis. When I use the chat() function to generate image responses, it results in the images being downloaded instead of being displayed on the page. My goal is to have these images shown directly in the app interface for better user experience.

Here’s a snippet of my code:

import pandas as pd
from pandasai import SmartDataframe
from langchain_groq.chat_models import ChatGroq
import os
import streamlit as st

# groq
llm = ChatGroq(model_name="llama3-70b-8192", api_key=os.environ["GROQ_API_KEY"])

# Streamlit app setup
st.title("Data Analysis with SmartDataframe")

df = pd.read_excel('data.xlsx')
df = SmartDataframe(df, config={"llm": llm})

st.write("Smart Dataframe")

# User input for chat command
user_input = st.text_input("Enter your command:")

if user_input:  # Check if user input is provided
    response = df.chat(user_input)  # Get response from SmartDataframe
    # Assuming response is an image URL or path
    st.image(response, use_container_width=True)  # This line triggers the download

Alternatives

No response

Additional context

No response

@dosubot dosubot bot added the enhancement New feature or request label Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant