update config.yaml and vision.py for configuration of vision

This commit is contained in:
mannaandpoem 2024-01-15 12:57:36 +08:00
parent 38929dc124
commit 841f69d5ed
3 changed files with 5 additions and 13 deletions

View file

@ -88,18 +88,9 @@ TIMEOUT: 60 # Timeout for llm invocation
#### for OPENAI VISION
#OPENAI_VISION_URL: "YOUR_OPENAI_ENDPOINT"
#OPENAI_VISION_KEY: "YOUR_API_KEY"
#OPENAI_VISION_MODEL: "YOUR_VISION_MODEL_NAME"
#VISION_MAX_TOKENS: 4096
#### for AZURE VISION
#AZURE_VISION_URL: "YOUR_AZURE_ENDPOINT"
#AZURE_VISION_KEY: "YOUR_API_KEY"
#AZURE_VISION_REGION: "YOUR_VISION_MODEL_NAME"
#VISION_MAX_TOKENS: 4096
#### for Stable Diffusion
## Use SD service, based on https://github.com/AUTOMATIC1111/stable-diffusion-webui
#SD_URL: "YOUR_SD_URL"

View file

@ -9,7 +9,7 @@ from metagpt.roles.code_interpreter import CodeInterpreter
async def main():
web_url = 'https://www.baidu.com/'
web_url = 'https://pytorch.org/'
prompt = f"""This is a URL of webpage: '{web_url}' .
Firstly, utilize Selenium and WebDriver for rendering.
Secondly, convert image to a webpage including HTML, CSS and JS in one go.

View file

@ -11,8 +11,8 @@ import base64
from metagpt.config import CONFIG
OPENAI_API_BASE = CONFIG.OPENAI_VISION_URL
API_KEY = CONFIG.OPENAI_VISION_KEY
OPENAI_API_BASE = CONFIG.OPENAI_BASE_URL
API_KEY = CONFIG.OPENAI_API_KEY
MODEL = CONFIG.OPENAI_VISION_MODEL
MAX_TOKENS = CONFIG.VISION_MAX_TOKENS
@ -77,6 +77,7 @@ class Vision:
if __name__ == "__main__":
image_path = "image.png"
vision = Vision()
rsp = vision.generate_web_pages(image_path="./img.png")
rsp = vision.generate_web_pages(image_path=image_path)
print(rsp)