Spaces:
Runtime error
Runtime error
JJteam
commited on
Commit
·
c21593a
1
Parent(s):
fc94cef
updating to azure gpt3.5turbo
Browse files- Dockerfile +1 -1
- MM-REACT/app.py +20 -7
- langchain-0.0.94-py3-none-any.whl +0 -0
Dockerfile
CHANGED
@@ -15,4 +15,4 @@ RUN pip install --no-cache-dir --upgrade -r /src/requirements.txt
|
|
15 |
WORKDIR /src/MM-REACT
|
16 |
|
17 |
|
18 |
-
CMD ["python", "app.py", "--port", "7860", "--openAIModel", "
|
|
|
15 |
WORKDIR /src/MM-REACT
|
16 |
|
17 |
|
18 |
+
CMD ["python", "app.py", "--port", "7860", "--openAIModel", "azureGPT35turbo", "--noIntermediateConv"]
|
MM-REACT/app.py
CHANGED
@@ -16,6 +16,7 @@ from langchain.llms import OpenAI
|
|
16 |
from langchain.chains import PALChain
|
17 |
from langchain.llms import AzureOpenAI
|
18 |
from langchain.utilities import ImunAPIWrapper, ImunMultiAPIWrapper
|
|
|
19 |
from openai.error import AuthenticationError, InvalidRequestError, RateLimitError
|
20 |
import argparse
|
21 |
import logging
|
@@ -100,15 +101,17 @@ def load_chain(history, log_state):
|
|
100 |
params=os.environ.get("IMUN_OCR_PARAMS"),
|
101 |
imun_subscription_key=os.environ.get("IMUN_OCR_SUBSCRIPTION_KEY"))
|
102 |
|
|
|
|
|
|
|
|
|
|
|
103 |
bing = BingSearchAPIWrapper(k=2)
|
104 |
|
105 |
def edit_photo(query: str) -> str:
|
106 |
endpoint = os.environ.get("PHOTO_EDIT_ENDPOINT_URL")
|
107 |
query = query.strip()
|
108 |
-
url_idx = query
|
109 |
-
img_url = query[url_idx + 1:].strip()
|
110 |
-
if img_url.endswith((".", "?")):
|
111 |
-
img_url = img_url[:-1]
|
112 |
if not img_url.startswith(("http://", "https://")):
|
113 |
return "Invalid image URL"
|
114 |
img_url = img_url.replace("0.0.0.0", os.environ.get("PHOTO_EDIT_ENDPOINT_URL_SHORT"))
|
@@ -180,6 +183,16 @@ def load_chain(history, log_state):
|
|
180 |
"Input should be an image url, or path to an image file (e.g. .jpg, .png)."
|
181 |
)
|
182 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
Tool(
|
184 |
name = "Celebrity Understanding",
|
185 |
func=imun_celeb.run,
|
@@ -405,7 +418,7 @@ def init_and_kick_off():
|
|
405 |
chat = ChatWrapper()
|
406 |
|
407 |
exampleTitle = """<h3>Examples to start conversation..</h3>"""
|
408 |
-
comingSoon = """<center><b><p style="color:Red;">MM-REACT: March
|
409 |
detailLinks = """
|
410 |
<center>
|
411 |
<a href="https://multimodal-react.github.io/"> MM-ReAct Website</a>
|
@@ -508,8 +521,8 @@ if __name__ == '__main__':
|
|
508 |
parser = argparse.ArgumentParser()
|
509 |
|
510 |
parser.add_argument('--port', type=int, required=False, default=7860)
|
511 |
-
parser.add_argument('--openAIModel', type=str, required=False, default='
|
512 |
-
parser.add_argument('--noIntermediateConv', default=
|
513 |
|
514 |
global ARGS
|
515 |
ARGS = parser.parse_args()
|
|
|
16 |
from langchain.chains import PALChain
|
17 |
from langchain.llms import AzureOpenAI
|
18 |
from langchain.utilities import ImunAPIWrapper, ImunMultiAPIWrapper
|
19 |
+
from langchain.utils import get_url_path
|
20 |
from openai.error import AuthenticationError, InvalidRequestError, RateLimitError
|
21 |
import argparse
|
22 |
import logging
|
|
|
101 |
params=os.environ.get("IMUN_OCR_PARAMS"),
|
102 |
imun_subscription_key=os.environ.get("IMUN_OCR_SUBSCRIPTION_KEY"))
|
103 |
|
104 |
+
imun_invoice = ImunAPIWrapper(
|
105 |
+
imun_url=os.environ.get("IMUN_OCR_INVOICE_URL"),
|
106 |
+
params=os.environ.get("IMUN_OCR_PARAMS"),
|
107 |
+
imun_subscription_key=os.environ.get("IMUN_OCR_SUBSCRIPTION_KEY"))
|
108 |
+
|
109 |
bing = BingSearchAPIWrapper(k=2)
|
110 |
|
111 |
def edit_photo(query: str) -> str:
|
112 |
endpoint = os.environ.get("PHOTO_EDIT_ENDPOINT_URL")
|
113 |
query = query.strip()
|
114 |
+
url_idx, img_url = get_url_path(query)
|
|
|
|
|
|
|
115 |
if not img_url.startswith(("http://", "https://")):
|
116 |
return "Invalid image URL"
|
117 |
img_url = img_url.replace("0.0.0.0", os.environ.get("PHOTO_EDIT_ENDPOINT_URL_SHORT"))
|
|
|
183 |
"Input should be an image url, or path to an image file (e.g. .jpg, .png)."
|
184 |
)
|
185 |
),
|
186 |
+
Tool(
|
187 |
+
name = "Invoice Understanding",
|
188 |
+
func=imun_invoice.run,
|
189 |
+
description=(
|
190 |
+
"A wrapper around invoice understanding. "
|
191 |
+
"Useful after Image Understanding tool has recognized businesscard in the image tags."
|
192 |
+
"This tool can find the actual business card text, name, address, email, website on the card."
|
193 |
+
"Input should be an image url, or path to an image file (e.g. .jpg, .png)."
|
194 |
+
)
|
195 |
+
),
|
196 |
Tool(
|
197 |
name = "Celebrity Understanding",
|
198 |
func=imun_celeb.run,
|
|
|
418 |
chat = ChatWrapper()
|
419 |
|
420 |
exampleTitle = """<h3>Examples to start conversation..</h3>"""
|
421 |
+
comingSoon = """<center><b><p style="color:Red;">MM-REACT: March 29th version with image understanding capabilities</p></b></center>"""
|
422 |
detailLinks = """
|
423 |
<center>
|
424 |
<a href="https://multimodal-react.github.io/"> MM-ReAct Website</a>
|
|
|
521 |
parser = argparse.ArgumentParser()
|
522 |
|
523 |
parser.add_argument('--port', type=int, required=False, default=7860)
|
524 |
+
parser.add_argument('--openAIModel', type=str, required=False, default='azureGPT35turbo')
|
525 |
+
parser.add_argument('--noIntermediateConv', default=True, action='store_true', help='if this flag is turned on no intermediate conversation should be shown')
|
526 |
|
527 |
global ARGS
|
528 |
ARGS = parser.parse_args()
|
langchain-0.0.94-py3-none-any.whl
CHANGED
Binary files a/langchain-0.0.94-py3-none-any.whl and b/langchain-0.0.94-py3-none-any.whl differ
|
|