stephenmccartney1234 commited on
Commit
aea4761
·
verified ·
1 Parent(s): 1622211

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -9,22 +9,22 @@ def chat_with_pdf(content):
9
  return "API key (CHATPDFKEY) not set in environment variables."
10
 
11
  headers = {
12
- "x-api-key": api_key,
13
  "Content-Type": "application/json",
14
  }
15
 
16
  data = {
17
- "stream": True,
18
- "sourceId": "src_opPediV0GhSqCEGkOph7S", # Replace with your source ID
19
- "messages": [
20
  {
21
- "role": "user",
22
- "content": content,
23
  },
24
  ],
25
  }
26
 
27
- url = "https://api.chatpdf.com/v1/chats/message"
28
 
29
  try:
30
  response = requests.post(url, json=data, headers=headers, stream=True)
 
9
  return "API key (CHATPDFKEY) not set in environment variables."
10
 
11
  headers = {
12
+ 'x-api-key': api_key,
13
  "Content-Type": "application/json",
14
  }
15
 
16
  data = {
17
+ 'stream': True,
18
+ 'sourceId': 'src_opPediV0GhSqCEGkOph7S', # Replace with your source ID
19
+ 'messages'': [
20
  {
21
+ 'role': "user",
22
+ 'content': content,
23
  },
24
  ],
25
  }
26
 
27
+ url = 'https://api.chatpdf.com/v1/chats/message'
28
 
29
  try:
30
  response = requests.post(url, json=data, headers=headers, stream=True)