Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -704,7 +704,7 @@ if __name__ == "__main__":
|
|
| 704 |
with gr.Column():
|
| 705 |
tokenize_output = gr.Code(label="Result (JSON)", language="json")
|
| 706 |
|
| 707 |
-
tokenize_btn.click(tokenize_text, [tokenize_input], [tokenize_output])
|
| 708 |
logger.info("[INIT] Tokenize tab components configured")
|
| 709 |
|
| 710 |
with gr.Tab("πΎ Prompt Cache"):
|
|
@@ -722,8 +722,8 @@ if __name__ == "__main__":
|
|
| 722 |
cache_get_btn = gr.Button("Retrieve", variant="secondary")
|
| 723 |
cache_get_output = gr.Code(label="Result", language="json")
|
| 724 |
|
| 725 |
-
cache_store_btn.click(cache_prompt, [cache_key_input, cache_value_input], [cache_store_output])
|
| 726 |
-
cache_get_btn.click(get_cached_prompt, [cache_get_input], [cache_get_output])
|
| 727 |
logger.info("[INIT] Prompt Cache tab components configured")
|
| 728 |
|
| 729 |
with gr.Tab("β‘ Response Cache"):
|
|
@@ -741,8 +741,8 @@ if __name__ == "__main__":
|
|
| 741 |
resp_get_btn = gr.Button("Get Response", variant="secondary")
|
| 742 |
resp_get_output = gr.Code(label="Result", language="json")
|
| 743 |
|
| 744 |
-
resp_cache_btn.click(cache_response, [resp_hash_input, resp_value_input], [resp_cache_output])
|
| 745 |
-
resp_get_btn.click(get_cached_response, [resp_get_input], [resp_get_output])
|
| 746 |
logger.info("[INIT] Response Cache tab components configured")
|
| 747 |
|
| 748 |
with gr.Tab("π° Token Accounting"):
|
|
@@ -755,7 +755,7 @@ if __name__ == "__main__":
|
|
| 755 |
calc_btn = gr.Button("Calculate Cost", variant="primary")
|
| 756 |
calc_output = gr.Code(label="Result (JSON)", language="json")
|
| 757 |
|
| 758 |
-
calc_btn.click(calculate_token_cost, [username_input, duration_input], [calc_output])
|
| 759 |
logger.info("[INIT] Token Accounting tab components configured")
|
| 760 |
|
| 761 |
with gr.Tab("π Stats"):
|
|
@@ -764,7 +764,7 @@ if __name__ == "__main__":
|
|
| 764 |
stats_btn = gr.Button("Get Stats", variant="primary")
|
| 765 |
stats_output = gr.Code(label="Statistics (JSON)", language="json")
|
| 766 |
|
| 767 |
-
stats_btn.click(get_cache_stats, None, [stats_output])
|
| 768 |
logger.info("[INIT] Stats tab components configured")
|
| 769 |
|
| 770 |
with gr.Tab("π₯ Health"):
|
|
@@ -773,7 +773,7 @@ if __name__ == "__main__":
|
|
| 773 |
health_btn = gr.Button("Check Health", variant="primary")
|
| 774 |
health_output = gr.Code(label="Health Status (JSON)", language="json")
|
| 775 |
|
| 776 |
-
health_btn.click(get_backend_health, None, [health_output])
|
| 777 |
logger.info("[INIT] Health tab components configured")
|
| 778 |
|
| 779 |
logger.info("[INIT] All tabs created successfully")
|
|
|
|
| 704 |
with gr.Column():
|
| 705 |
tokenize_output = gr.Code(label="Result (JSON)", language="json")
|
| 706 |
|
| 707 |
+
tokenize_btn.click(tokenize_text, [tokenize_input], [tokenize_output], api_name="/predict")
|
| 708 |
logger.info("[INIT] Tokenize tab components configured")
|
| 709 |
|
| 710 |
with gr.Tab("πΎ Prompt Cache"):
|
|
|
|
| 722 |
cache_get_btn = gr.Button("Retrieve", variant="secondary")
|
| 723 |
cache_get_output = gr.Code(label="Result", language="json")
|
| 724 |
|
| 725 |
+
cache_store_btn.click(cache_prompt, [cache_key_input, cache_value_input], [cache_store_output], api_name="/predict_2")
|
| 726 |
+
cache_get_btn.click(get_cached_prompt, [cache_get_input], [cache_get_output], api_name="/predict_3")
|
| 727 |
logger.info("[INIT] Prompt Cache tab components configured")
|
| 728 |
|
| 729 |
with gr.Tab("β‘ Response Cache"):
|
|
|
|
| 741 |
resp_get_btn = gr.Button("Get Response", variant="secondary")
|
| 742 |
resp_get_output = gr.Code(label="Result", language="json")
|
| 743 |
|
| 744 |
+
resp_cache_btn.click(cache_response, [resp_hash_input, resp_value_input], [resp_cache_output], api_name="/predict_4")
|
| 745 |
+
resp_get_btn.click(get_cached_response, [resp_get_input], [resp_get_output], api_name="/predict_5")
|
| 746 |
logger.info("[INIT] Response Cache tab components configured")
|
| 747 |
|
| 748 |
with gr.Tab("π° Token Accounting"):
|
|
|
|
| 755 |
calc_btn = gr.Button("Calculate Cost", variant="primary")
|
| 756 |
calc_output = gr.Code(label="Result (JSON)", language="json")
|
| 757 |
|
| 758 |
+
calc_btn.click(calculate_token_cost, [username_input, duration_input], [calc_output], api_name="/predict_6")
|
| 759 |
logger.info("[INIT] Token Accounting tab components configured")
|
| 760 |
|
| 761 |
with gr.Tab("π Stats"):
|
|
|
|
| 764 |
stats_btn = gr.Button("Get Stats", variant="primary")
|
| 765 |
stats_output = gr.Code(label="Statistics (JSON)", language="json")
|
| 766 |
|
| 767 |
+
stats_btn.click(get_cache_stats, None, [stats_output], api_name="/predict_7")
|
| 768 |
logger.info("[INIT] Stats tab components configured")
|
| 769 |
|
| 770 |
with gr.Tab("π₯ Health"):
|
|
|
|
| 773 |
health_btn = gr.Button("Check Health", variant="primary")
|
| 774 |
health_output = gr.Code(label="Health Status (JSON)", language="json")
|
| 775 |
|
| 776 |
+
health_btn.click(get_backend_health, None, [health_output], api_name="/predict_8")
|
| 777 |
logger.info("[INIT] Health tab components configured")
|
| 778 |
|
| 779 |
logger.info("[INIT] All tabs created successfully")
|