Skip to content

Commit

Permalink
Don't reload if download CSV.
Browse files Browse the repository at this point in the history
Always add user_input as separate column.
  • Loading branch information
ErikBorra committed Dec 2, 2023
1 parent 7479503 commit b374cb3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions PromptCompass.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import json
import streamlit as st
import streamlit_ext as ste
import os
import time
import gc
import pandas as pd
import tiktoken
from dotenv import load_dotenv
from langchain.chains import LLMChain # import LangChain libraries
from langchain.llms import OpenAI # import OpenAI model
Expand Down Expand Up @@ -196,6 +196,7 @@ def main():

# process the selected column from the dataframe
input_values['user'] = data[column_to_extract].tolist()
data['user_input'] = input_values['user']

# Determine the output file name
filename = uploaded_file.name if uploaded_file else 'output.csv'
Expand Down Expand Up @@ -521,12 +522,11 @@ def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor, **kwa

# make output available as csv
csv = data.to_csv(index=False).encode('utf-8')
st.download_button(
ste.download_button(
"Download CSV",
csv,
output_filename,
"text/csv",
key='download-csv'
)

end_time = time.time()
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
streamlit
streamlit-ext
python_dotenv
langchain
openai
Expand Down

0 comments on commit b374cb3

Please sign in to comment.