markytools commited on
Commit
8060e77
·
1 Parent(s): 005a493
Files changed (1) hide show
  1. app.py +8 -24
app.py CHANGED
@@ -37,24 +37,6 @@ if uploaded_file is not None:
37
  with NamedTemporaryFile(dir='.', suffix=f'.{pdfCSVURLText.lower()}') as f:
38
  f.write(uploaded_file.getbuffer())
39
  uploadedFilename = f.name
40
- # st.write('The current uploaded file is', f.name)
41
-
42
-
43
- # # To read file as bytes:
44
- # bytes_data = uploaded_file.getvalue()
45
- # st.write(bytes_data)
46
- #
47
- # # To convert to a string based IO:
48
- # stringio = StringIO(uploaded_file.getvalue().decode("utf-8"))
49
- # st.write(stringio)
50
- #
51
- # # To read file as string:
52
- # string_data = stringio.read()
53
- # st.write(string_data)
54
- #
55
- # # Can be used wherever a "file-like" object is accepted:
56
- # dataframe = pd.read_csv(uploaded_file)
57
- # st.write(dataframe)
58
 
59
  enableChatBox = False
60
  if genre==radioButtonList[0]:
@@ -66,11 +48,13 @@ elif genre==radioButtonList[2]:
66
  elif genre==radioButtonList[3]:
67
  enableChatBox = True
68
  elif genre==radioButtonList[4]:
69
- enableChatBox = isValidURL
70
 
71
- title = st.text_input(f'Ask me anything about this {pdfCSVURLText}', '', placeholder="Type your question here (e.g. what was the most sold item?)", disabled=not enableChatBox)
72
  chatWithPDFButton = "CLICK HERE TO START CHATTING"
73
- if st.button(chatWithPDFButton, disabled=not enableChatBox):
74
- pass
75
- else:
76
- pass
 
 
 
37
  with NamedTemporaryFile(dir='.', suffix=f'.{pdfCSVURLText.lower()}') as f:
38
  f.write(uploaded_file.getbuffer())
39
  uploadedFilename = f.name
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
 
41
  enableChatBox = False
42
  if genre==radioButtonList[0]:
 
48
  elif genre==radioButtonList[3]:
49
  enableChatBox = True
50
  elif genre==radioButtonList[4]:
51
+ enableChatBox = True
52
 
53
+ chatTextStr = st.text_input(f'Ask me anything about this {pdfCSVURLText}', '', placeholder="Type your question here (e.g. what was the most sold item?)", disabled=not enableChatBox)
54
  chatWithPDFButton = "CLICK HERE TO START CHATTING"
55
+ if st.button(chatWithPDFButton, disabled=not enableChatBox and not chatTextStr): # Button Cliked
56
+ if genre==radioButtonList[4] and not isValidURL:
57
+ st.write('Invalid ULR. Please enter a valid URL.')
58
+ print("Successfully processed files")
59
+ # else:
60
+ # pass