rogerxavier commited on
Commit
2f83ae5
1 Parent(s): d7b51c4

Update 2magiDialogCut.py

Browse files
Files changed (1) hide show
  1. 2magiDialogCut.py +20 -19
2magiDialogCut.py CHANGED
@@ -6,24 +6,24 @@ import os
6
 
7
 
8
  def getImgCoordinatesByMagi(image_path:"包含后缀的文件路径") -> "全部对话坐标list,失败返回none":
9
- headers = {
10
- 'authority': 'rogerxavier-fastapi-t5-magi.hf.space',
11
- 'method': 'GET',
12
- 'scheme': 'https',
13
- 'Accept': '*/*',
14
- 'Accept-Encoding': 'gzip, deflate, br, zstd',
15
- 'Accept-Language': 'zh-CN,zh;q=0.9',
16
- 'Cookie': 'spaces-jwt=eyJhbGciOiJFZERTQSJ9.eyJyZWFkIjp0cnVlLCJwZXJtaXNzaW9ucyI6eyJyZXBvLmNvbnRlbnQucmVhZCI6dHJ1ZX0sIm9uQmVoYWxmT2YiOnsia2luZCI6InVzZXIiLCJfaWQiOiI2NDJhNTNiNTE2ZDRkODI5M2M5YjdiNzgiLCJ1c2VyIjoicm9nZXJ4YXZpZXIifSwiaWF0IjoxNzE2NjExMTE3LCJzdWIiOiIvc3BhY2VzL3JvZ2VyeGF2aWVyL2Zhc3RhcGlfdDVfbWFnaSIsImV4cCI6MTcxNjY5NzUxNywiaXNzIjoiaHR0cHM6Ly9odWdnaW5nZmFjZS5jbyJ9.W00jo8kiRgwCpq5aaGhaPE2RP2jLOyvfimjyIfHVhP1gs7NHkBkRzVTFqYv3TRtZoHNPTiFiI5Ehu12KP06sDQ',
17
- 'Dnt': '1',
18
- 'Priority': 'u=1, i',
19
- 'Sec-Ch-Ua': '"Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99"',
20
- 'Sec-Ch-Ua-Mobile': '?0',
21
- 'Sec-Ch-Ua-Platform': '"Windows"',
22
- 'Sec-Fetch-Dest': 'empty',
23
- 'Sec-Fetch-Mode': 'cors',
24
- 'Sec-Fetch-Site': 'same-origin',
25
- 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36'
26
- }
27
  with open(image_path, 'rb') as file:
28
  image_bytes = file.read()
29
  files = {
@@ -31,7 +31,8 @@ def getImgCoordinatesByMagi(image_path:"包含后缀的文件路径") -> "全部
31
  }
32
  magi_fastapi_base = 'https://rogerxavier-fastapi-t5-magi.hf.space/getCoordinates'
33
  try:
34
- resp = requests.post(magi_fastapi_base, files=files, headers=headers) ##是仓库public后好像就api可用了
 
35
  print(resp.json())
36
  return resp.json()["panels"]
37
  except Exception as e:
 
6
 
7
 
8
  def getImgCoordinatesByMagi(image_path:"包含后缀的文件路径") -> "全部对话坐标list,失败返回none":
9
+ # headers = {
10
+ # 'authority': 'rogerxavier-fastapi-t5-magi.hf.space',
11
+ # 'method': 'GET',
12
+ # 'scheme': 'https',
13
+ # 'Accept': '*/*',
14
+ # 'Accept-Encoding': 'gzip, deflate, br, zstd',
15
+ # 'Accept-Language': 'zh-CN,zh;q=0.9',
16
+ # 'Cookie': 'spaces-jwt=eyJhbGciOiJFZERTQSJ9.eyJyZWFkIjp0cnVlLCJwZXJtaXNzaW9ucyI6eyJyZXBvLmNvbnRlbnQucmVhZCI6dHJ1ZX0sIm9uQmVoYWxmT2YiOnsia2luZCI6InVzZXIiLCJfaWQiOiI2NDJhNTNiNTE2ZDRkODI5M2M5YjdiNzgiLCJ1c2VyIjoicm9nZXJ4YXZpZXIifSwiaWF0IjoxNzE2NjExMTE3LCJzdWIiOiIvc3BhY2VzL3JvZ2VyeGF2aWVyL2Zhc3RhcGlfdDVfbWFnaSIsImV4cCI6MTcxNjY5NzUxNywiaXNzIjoiaHR0cHM6Ly9odWdnaW5nZmFjZS5jbyJ9.W00jo8kiRgwCpq5aaGhaPE2RP2jLOyvfimjyIfHVhP1gs7NHkBkRzVTFqYv3TRtZoHNPTiFiI5Ehu12KP06sDQ',
17
+ # 'Dnt': '1',
18
+ # 'Priority': 'u=1, i',
19
+ # 'Sec-Ch-Ua': '"Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99"',
20
+ # 'Sec-Ch-Ua-Mobile': '?0',
21
+ # 'Sec-Ch-Ua-Platform': '"Windows"',
22
+ # 'Sec-Fetch-Dest': 'empty',
23
+ # 'Sec-Fetch-Mode': 'cors',
24
+ # 'Sec-Fetch-Site': 'same-origin',
25
+ # 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36'
26
+ # }
27
  with open(image_path, 'rb') as file:
28
  image_bytes = file.read()
29
  files = {
 
31
  }
32
  magi_fastapi_base = 'https://rogerxavier-fastapi-t5-magi.hf.space/getCoordinates'
33
  try:
34
+ # resp = requests.post(magi_fastapi_base, files=files, headers=headers) ##是仓库public后好像就api可用了
35
+ resp = requests.post(magi_fastapi_base, files=files) ##不使用header看看会不会还限制
36
  print(resp.json())
37
  return resp.json()["panels"]
38
  except Exception as e: