Yhhxhfh commited on
Commit
4b2e116
·
verified ·
1 Parent(s): 2dc339d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -9,6 +9,7 @@ from fastapi import FastAPI, Request
9
  from fastapi.responses import JSONResponse
10
  import spaces
11
  import urllib3
 
12
 
13
  urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
14
 
@@ -89,9 +90,12 @@ def remove_duplicates(text):
89
  @spaces.GPU()
90
  async def generate_combined_response(inputs):
91
  combined_response = ""
 
 
 
92
  for model in global_data['model']:
93
  try:
94
- response = model(inputs)
95
  combined_response += remove_duplicates(response['choices'][0]['text']) + "\n"
96
  except Exception as e:
97
  pass
 
9
  from fastapi.responses import JSONResponse
10
  import spaces
11
  import urllib3
12
+ import random
13
 
14
  urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
15
 
 
90
  @spaces.GPU()
91
  async def generate_combined_response(inputs):
92
  combined_response = ""
93
+ top_p = round(random.uniform(0.1, 1.0), 2)
94
+ top_k = random.randint(1, 100)
95
+ temperature = round(random.uniform(0.1, 2.0), 2)
96
  for model in global_data['model']:
97
  try:
98
+ response = model(inputs, top_p=top_p, top_k=top_k, temperature=temperature)
99
  combined_response += remove_duplicates(response['choices'][0]['text']) + "\n"
100
  except Exception as e:
101
  pass