Spaces:
Running
Running
Dongxu Li
commited on
Commit
·
7667e4b
1
Parent(s):
66be1ae
update port to 8080.
Browse files
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 |
-
|
| 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 |
-
|
| 20 |
-
config = response.json()
|
| 21 |
|
| 22 |
-
return
|
| 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():
|