SteveTran commited on
Commit
f85e000
·
verified ·
1 Parent(s): 86fc1ec

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -5,6 +5,8 @@ import os
5
  import gradio as gr
6
 
7
  ML_ENDPOINT_URL = os.environ.get("ML_ENDPOINT_URL", "http://50.18.255.74:8040/rewrite")
 
 
8
 
9
  # Example queries to help users understand the app
10
  EXAMPLE_QUERIES = [
@@ -27,7 +29,7 @@ def make_request(query):
27
  # Replace with your actual API endpoint
28
  if "rewrite: " not in query:
29
  query = f"rewrite: {query}"
30
- response = requests.post(ML_ENDPOINT_URL, json={"inputs": query})
31
  response.raise_for_status()
32
  result = response.json()
33
  except requests.exceptions.RequestException as e:
 
5
  import gradio as gr
6
 
7
  ML_ENDPOINT_URL = os.environ.get("ML_ENDPOINT_URL", "http://50.18.255.74:8040/rewrite")
8
+ client_session = requests.Session()
9
+ client_session.keep_alive = 5
10
 
11
  # Example queries to help users understand the app
12
  EXAMPLE_QUERIES = [
 
29
  # Replace with your actual API endpoint
30
  if "rewrite: " not in query:
31
  query = f"rewrite: {query}"
32
+ response = client_session.post(ML_ENDPOINT_URL, json={"inputs": query})
33
  response.raise_for_status()
34
  result = response.json()
35
  except requests.exceptions.RequestException as e: