Vincent Claes commited on
Commit
81feeba
1 Parent(s): df2dfd8

do post request

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -1,15 +1,12 @@
 
1
  import os
2
  import gradio as gr
3
  import requests
4
  import intro
5
  def search_resume(input_text):
6
- from urllib.parse import quote
7
- encoded_sentence = quote(input_text)
8
-
9
- url = f"https://n970resrb9.execute-api.eu-west-1.amazonaws.com/dev/prediction/{encoded_sentence}" # replace with your API endpoint
10
  headers = {'Content-Type': 'application/json', "x-api-key": os.environ["API_KEY"]} # adjust headers as needed
11
- # data = {"id": input_text} # data to be sent to the API
12
- response = requests.get(url, headers=headers)
13
  response_data = response.json()
14
 
15
  if 'prediction' in response_data:
 
1
+ import json
2
  import os
3
  import gradio as gr
4
  import requests
5
  import intro
6
  def search_resume(input_text):
7
+ url = f"https://n970resrb9.execute-api.eu-west-1.amazonaws.com/dev/prediction" # replace with your API endpoint
 
 
 
8
  headers = {'Content-Type': 'application/json', "x-api-key": os.environ["API_KEY"]} # adjust headers as needed
9
+ response = requests.post(url, headers=headers, data=json.dumps({"text": input_text}))
 
10
  response_data = response.json()
11
 
12
  if 'prediction' in response_data: