conf.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. """
  2. 配置文件
  3. 包含API密钥、模型配置等常量
  4. """
  5. # ==================== API配置 ====================
  6. # 豆包API配置 (api_key, base_url)
  7. doubao_ky = (
  8. "817dff39-5586-4f9b-acba-55004167c0b1",
  9. "https://ark.cn-beijing.volces.com/api/v3"
  10. )
  11. # 阿里云API配置 (api_key, base_url)
  12. ali_ky = (
  13. "sk-04b63960983445f980d85ff185a17876",
  14. "https://dashscope.aliyuncs.com/compatible-mode/v1"
  15. )
  16. # ==================== 模型配置 ====================
  17. # 豆包模型配置
  18. doubao_model = {
  19. "text_doubao": "ep-20241018084532-cgm84",
  20. "text_ds": "deepseek-r1-250120",
  21. "mm_doubao": "doubao-1-5-vision-pro-32k-250115"
  22. }
  23. # 阿里云模型配置
  24. ali_model = {
  25. "text_qwen": "qwen3-max", # 注意:覆盖了前面的 "qwen-max-2025-01-25"
  26. "text_ds": "deepseek-r1",
  27. "text_dsv3": "deepseek-v3",
  28. "mm_tyqw": "qwen-vl-max",
  29. "mm_qwen": "qwen3-vl-plus"
  30. }
  31. import requests
  32. size_dict={
  33. "1600x1600":[1,1],
  34. "1800x2400":[3,4],
  35. "1600x2400":[2,3],
  36. "1080x1350":[4,5],
  37. "1200x1500":[4,5],
  38. "1920x1080":[16,9],
  39. "2000x2000":[1,1]}
  40. # API_KEY="sk-qnsfJw0vsAitlnrXcOeBYrLbTv9LXfsN1m3jIUfMJagan5IR",
  41. # BASE_URL="https://api.openaius.com/"
  42. check_prompt="""图2是不是图1的衣服的线稿款式图,而且除了衣服的线稿外没有其他的元素了?是不是只有黑白线稿没有颜色的,是不是不含人台(mannequin)的线稿,是不是衣服的数量和特征都对应上了,是的话回答是,否则回答否"""
  43. if __name__ == '__main__':
  44. ratio=(2,3)
  45. print(size_dict)
  46. # print(size_url[str(ratio[0])+":"+str(ratio[1])])
  47. import io
  48. from PIL import Image
  49. # 下载原图为 PIL.Image
  50. resp_img = requests.get("https://v3.fal.media/files/monkey/gtn7F5ZWMJ2SwcdWiwpkh.jpeg", timeout=30)
  51. resp_img.raise_for_status()
  52. pil_image = Image.open(io.BytesIO(resp_img.content)).convert("RGB")
  53. print(pil_image)