MatteoScript commited on
Commit
535379e
·
verified ·
1 Parent(s): 99bc6f9

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -3
main.py CHANGED
@@ -157,14 +157,14 @@ def generate_textAsync(request: Request, input_data: InputDataAsync):
157
  result_data = asyncio.run(GeneraTestoAsync("https://matteoscript-fastapi.hf.space/Genera", input_data))
158
  return {"response": result_data}
159
 
160
- async def make_request(session, token, data, url, max_retries=3, index):
161
  headers = {
162
  'Content-Type': 'application/json',
163
  'Authorization': 'Bearer ' + token
164
  }
165
- if index % 3 == 1:
166
  data.max_new_tokens = data.max_new_tokens
167
- elif index % 3 == 2:
168
  data.max_new_tokens = max(200, data.max_new_tokens - 200)
169
  else:
170
  data.max_new_tokens = data.max_new_tokens + 200
 
157
  result_data = asyncio.run(GeneraTestoAsync("https://matteoscript-fastapi.hf.space/Genera", input_data))
158
  return {"response": result_data}
159
 
160
+ async def make_request(session, token, data, url, max_retries=3, i):
161
  headers = {
162
  'Content-Type': 'application/json',
163
  'Authorization': 'Bearer ' + token
164
  }
165
+ if i % 3 == 1:
166
  data.max_new_tokens = data.max_new_tokens
167
+ elif i % 3 == 2:
168
  data.max_new_tokens = max(200, data.max_new_tokens - 200)
169
  else:
170
  data.max_new_tokens = data.max_new_tokens + 200