HCPTangHY commited on
Commit
43603aa
·
verified ·
1 Parent(s): f9c133e

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +34 -34
main.py CHANGED
@@ -94,40 +94,40 @@ async def proxy(request: Request, model_path: str, api_key: str = Security(get_a
94
  request_json["generationConfig"]
95
  request_json["generationConfig"]["responseModalities"] = ["TEXT", "IMAGE"]
96
 
97
- request_json["safetySettings"] = [
98
- {
99
- "category": "HARM_CATEGORY_HATE_SPEECH",
100
- "threshold": "BLOCK_NONE"
101
- },
102
- {
103
- "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
104
- "threshold": "BLOCK_NONE"
105
- },
106
- {
107
- "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
108
- "threshold": "BLOCK_NONE"
109
- },
110
- {
111
- "category": "HARM_CATEGORY_HARASSMENT",
112
- "threshold": "BLOCK_NONE"
113
- },
114
- {
115
- "category": "HARM_CATEGORY_IMAGE_HATE",
116
- "threshold": "BLOCK_NONE"
117
- },
118
- {
119
- "category": "HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT",
120
- "threshold": "BLOCK_NONE"
121
- },
122
- {
123
- "category": "HARM_CATEGORY_IMAGE_HARASSMENT",
124
- "threshold": "BLOCK_NONE"
125
- },
126
- {
127
- "category": "HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT",
128
- "threshold": "BLOCK_NONE"
129
- }
130
- ]
131
  request_body_to_send = json.dumps(request_json).encode('utf-8')
132
  except json.JSONDecodeError:
133
  pass # Not a json body, proxy as is
 
94
  request_json["generationConfig"]
95
  request_json["generationConfig"]["responseModalities"] = ["TEXT", "IMAGE"]
96
 
97
+ # request_json["safetySettings"] = [
98
+ # {
99
+ # "category": "HARM_CATEGORY_HATE_SPEECH",
100
+ # "threshold": "BLOCK_NONE"
101
+ # },
102
+ # {
103
+ # "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
104
+ # "threshold": "BLOCK_NONE"
105
+ # },
106
+ # {
107
+ # "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
108
+ # "threshold": "BLOCK_NONE"
109
+ # },
110
+ # {
111
+ # "category": "HARM_CATEGORY_HARASSMENT",
112
+ # "threshold": "BLOCK_NONE"
113
+ # },
114
+ # {
115
+ # "category": "HARM_CATEGORY_IMAGE_HATE",
116
+ # "threshold": "BLOCK_NONE"
117
+ # },
118
+ # {
119
+ # "category": "HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT",
120
+ # "threshold": "BLOCK_NONE"
121
+ # },
122
+ # {
123
+ # "category": "HARM_CATEGORY_IMAGE_HARASSMENT",
124
+ # "threshold": "BLOCK_NONE"
125
+ # },
126
+ # {
127
+ # "category": "HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT",
128
+ # "threshold": "BLOCK_NONE"
129
+ # }
130
+ # ]
131
  request_body_to_send = json.dumps(request_json).encode('utf-8')
132
  except json.JSONDecodeError:
133
  pass # Not a json body, proxy as is