awacke1 commited on
Commit
5e39c57
β€’
1 Parent(s): 29b3073

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -8
app.py CHANGED
@@ -16,10 +16,6 @@ openai.api_key = os.getenv('OPENAI_KEY')
16
  st.set_page_config(
17
  page_title="GPT Streamlit Document Reasoner",
18
  layout="wide")
19
- # st.title("GPT Chat with Optional File Context - Talk to your data!")
20
-
21
- # Output options sidebar menu
22
- # st.sidebar.title("Output Options")
23
  menu = ["txt", "htm", "md"]
24
  choice = st.sidebar.selectbox("Choose output file type to save results", menu)
25
  choicePrefix = "Output and download file set to "
@@ -32,10 +28,8 @@ elif choice == "md":
32
  elif choice == "py":
33
  st.sidebar.write(choicePrefix + "Python AI UI/UX")
34
 
35
- # sidebar slider for file input length to include in inference blocks
36
  max_length = st.sidebar.slider("Max document length", min_value=1000, max_value=32000, value=3000, step=1000)
37
 
38
- # Truncate document
39
  def truncate_document(document, length):
40
  return document[:length]
41
 
@@ -49,8 +43,8 @@ def chat_with_model(prompts):
49
 
50
  def generate_filename(prompt, file_type):
51
  central = pytz.timezone('US/Central')
52
- safe_date_time = datetime.now(central).strftime("%m%d_%I_%M_%p")
53
- safe_prompt = "".join(x for x in prompt if x.isalnum())[:30]
54
  return f"{safe_date_time}_{safe_prompt}.{file_type}"
55
 
56
  def create_file(filename, prompt, response):
 
16
  st.set_page_config(
17
  page_title="GPT Streamlit Document Reasoner",
18
  layout="wide")
 
 
 
 
19
  menu = ["txt", "htm", "md"]
20
  choice = st.sidebar.selectbox("Choose output file type to save results", menu)
21
  choicePrefix = "Output and download file set to "
 
28
  elif choice == "py":
29
  st.sidebar.write(choicePrefix + "Python AI UI/UX")
30
 
 
31
  max_length = st.sidebar.slider("Max document length", min_value=1000, max_value=32000, value=3000, step=1000)
32
 
 
33
  def truncate_document(document, length):
34
  return document[:length]
35
 
 
43
 
44
  def generate_filename(prompt, file_type):
45
  central = pytz.timezone('US/Central')
46
+ safe_date_time = datetime.now(central).strftime("%m%d_%I%M")
47
+ safe_prompt = "".join(x for x in prompt if x.isalnum())[:28]
48
  return f"{safe_date_time}_{safe_prompt}.{file_type}"
49
 
50
  def create_file(filename, prompt, response):