Dongxu Li commited on
Commit
7667e4b
1 Parent(s): 66be1ae

update port to 8080.

Browse files
Files changed (2) hide show
  1. app.py +2 -2
  2. utils.py +2 -6
app.py CHANGED
@@ -19,6 +19,7 @@ def query_chat_api(
19
  ):
20
 
21
  url = endpoint.url
 
22
 
23
  headers = {
24
  "User-Agent": "BLIP-2 HuggingFace Space",
@@ -49,8 +50,7 @@ def query_caption_api(
49
  ):
50
 
51
  url = endpoint.url
52
- # replace /generate with /caption
53
- url = url.replace("/generate", "/caption")
54
 
55
  headers = {
56
  "User-Agent": "BLIP-2 HuggingFace Space",
 
19
  ):
20
 
21
  url = endpoint.url
22
+ url = url + "/api/generate"
23
 
24
  headers = {
25
  "User-Agent": "BLIP-2 HuggingFace Space",
 
50
  ):
51
 
52
  url = endpoint.url
53
+ url = url + "/api/caption"
 
54
 
55
  headers = {
56
  "User-Agent": "BLIP-2 HuggingFace Space",
utils.py CHANGED
@@ -1,11 +1,8 @@
1
  import os
2
- import requests
3
 
4
 
5
  class Endpoint:
6
  def __init__(self):
7
- self.config_path = "https://storage.googleapis.com/sfr-vision-language-research/LAVIS/projects/blip2/config.json"
8
-
9
  self._url = None
10
 
11
  @property
@@ -16,10 +13,9 @@ class Endpoint:
16
  return self._url
17
 
18
  def get_url(self):
19
- response = requests.get(self.config_path)
20
- config = response.json()
21
 
22
- return config["endpoint"]
23
 
24
 
25
  def get_token():
 
1
  import os
 
2
 
3
 
4
  class Endpoint:
5
  def __init__(self):
 
 
6
  self._url = None
7
 
8
  @property
 
13
  return self._url
14
 
15
  def get_url(self):
16
+ endpoint = os.environ.get("endpoint")
 
17
 
18
+ return endpoint
19
 
20
 
21
  def get_token():