tsereno commited on
Commit
e13bc5b
1 Parent(s): 7c0cfe6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -63,17 +63,16 @@ def bot(
63
  "Please follow the instructions in the README to set it up.")
64
 
65
  if file_prompt is not None:
66
- # Initialize an empty list to store file contents
67
- file_contents = []
68
  for file in file_prompt:
69
  # Open the file in read binary mode ('rb')
70
  with open(file.name, 'rb') as f:
71
  # Read the entire file content into a byte string
72
  content = f.read()
73
  # Decode the byte string to a UTF-8 string (assuming text file)
74
- file_contents.append(content.decode('utf-8'))
75
- chatbot[-1] = (file_contents + chatbot[-1][0], chatbot[-1][1])
76
- text_prompt = chatbot[-1][0]
77
  genai.configure(api_key=google_key)
78
  generation_config = genai.types.GenerationConfig(
79
  temperature=temperature,
 
63
  "Please follow the instructions in the README to set it up.")
64
 
65
  if file_prompt is not None:
66
+ # Initialize an empty string to store content
67
+ all_content = ""
68
  for file in file_prompt:
69
  # Open the file in read binary mode ('rb')
70
  with open(file.name, 'rb') as f:
71
  # Read the entire file content into a byte string
72
  content = f.read()
73
  # Decode the byte string to a UTF-8 string (assuming text file)
74
+ all_content += content.decode('utf-8')
75
+ text_prompt = all_content + " " + chatbot[-1][0]
 
76
  genai.configure(api_key=google_key)
77
  generation_config = genai.types.GenerationConfig(
78
  temperature=temperature,