Spaces:
Running
Running
rate limit
Browse files
app.py
CHANGED
|
@@ -27,8 +27,8 @@ def respond_base(
|
|
| 27 |
host_addr = request.client.host
|
| 28 |
if host_addr not in addr_limit_counter:
|
| 29 |
addr_limit_counter[host_addr] = 0
|
| 30 |
-
if addr_limit_counter[host_addr] >
|
| 31 |
-
raise gr.Error("You have reached the limit of 50 requests for today.
|
| 32 |
|
| 33 |
base_answer = get_base_answer(base_model=base_model, system_prompt=system_prompt, question=message, max_tokens=max_tokens)
|
| 34 |
addr_limit_counter[host_addr] += 1
|
|
@@ -54,8 +54,8 @@ def respond_nudging(
|
|
| 54 |
host_addr = request.client.host
|
| 55 |
if host_addr not in addr_limit_counter:
|
| 56 |
addr_limit_counter[host_addr] = 0
|
| 57 |
-
if addr_limit_counter[host_addr] >
|
| 58 |
-
raise gr.Error("You have reached the limit of 50 requests for today.
|
| 59 |
all_info = get_nudging_answer(base_model=base_model, nudging_model=nudging_model, system_prompt=system_prompt, question=message, max_token_total=max_tokens, top_prob_thres=nudging_thres)
|
| 60 |
all_completions = all_info["all_completions"]
|
| 61 |
nudging_words = all_info["all_nudging_words"]
|
|
|
|
| 27 |
host_addr = request.client.host
|
| 28 |
if host_addr not in addr_limit_counter:
|
| 29 |
addr_limit_counter[host_addr] = 0
|
| 30 |
+
if addr_limit_counter[host_addr] > 50:
|
| 31 |
+
raise gr.Error("You have reached the limit of 50 requests for today.", duration=10)
|
| 32 |
|
| 33 |
base_answer = get_base_answer(base_model=base_model, system_prompt=system_prompt, question=message, max_tokens=max_tokens)
|
| 34 |
addr_limit_counter[host_addr] += 1
|
|
|
|
| 54 |
host_addr = request.client.host
|
| 55 |
if host_addr not in addr_limit_counter:
|
| 56 |
addr_limit_counter[host_addr] = 0
|
| 57 |
+
if addr_limit_counter[host_addr] > 50:
|
| 58 |
+
raise gr.Error("You have reached the limit of 50 requests for today.", duration=10)
|
| 59 |
all_info = get_nudging_answer(base_model=base_model, nudging_model=nudging_model, system_prompt=system_prompt, question=message, max_token_total=max_tokens, top_prob_thres=nudging_thres)
|
| 60 |
all_completions = all_info["all_completions"]
|
| 61 |
nudging_words = all_info["all_nudging_words"]
|