schroneko
commited on
Commit
·
90e9d82
1
Parent(s):
2ad0118
Refactor codebase
Browse files- Remove unused pyproject.toml and uv.lock files (HuggingFace Spaces uses requirements.txt)
- Remove unused imports (Path, Any, Optional)
- Reorganize imports to follow standard order (stdlib, third-party)
- Remove unused api_key parameter from create_demo function
- Pin anthropic version to >=0.38.0 in requirements.txt
- app.py +5 -5
- pyproject.toml +0 -10
- requirements.txt +2 -2
- uv.lock +0 -0
app.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
import base64
|
|
|
|
| 3 |
import os
|
| 4 |
-
from typing import
|
|
|
|
| 5 |
import anthropic
|
| 6 |
-
import
|
| 7 |
-
from pathlib import Path
|
| 8 |
|
| 9 |
|
| 10 |
def count_tokens(
|
|
@@ -104,7 +104,7 @@ def count_tokens(
|
|
| 104 |
return None, f"Error: {error_msg}"
|
| 105 |
|
| 106 |
|
| 107 |
-
def create_demo(
|
| 108 |
with gr.Blocks(title="Anthropic API Token Counter") as demo:
|
| 109 |
gr.Markdown("# Anthropic API Token Counter")
|
| 110 |
gr.Markdown("""
|
|
|
|
|
|
|
| 1 |
import base64
|
| 2 |
+
import json
|
| 3 |
import os
|
| 4 |
+
from typing import Dict, List, Tuple
|
| 5 |
+
|
| 6 |
import anthropic
|
| 7 |
+
import gradio as gr
|
|
|
|
| 8 |
|
| 9 |
|
| 10 |
def count_tokens(
|
|
|
|
| 104 |
return None, f"Error: {error_msg}"
|
| 105 |
|
| 106 |
|
| 107 |
+
def create_demo() -> gr.Blocks:
|
| 108 |
with gr.Blocks(title="Anthropic API Token Counter") as demo:
|
| 109 |
gr.Markdown("# Anthropic API Token Counter")
|
| 110 |
gr.Markdown("""
|
pyproject.toml
DELETED
|
@@ -1,10 +0,0 @@
|
|
| 1 |
-
[project]
|
| 2 |
-
name = "anthropic-api-token-counter"
|
| 3 |
-
version = "0.1.0"
|
| 4 |
-
description = "Add your description here"
|
| 5 |
-
readme = "README.md"
|
| 6 |
-
requires-python = ">=3.11"
|
| 7 |
-
dependencies = [
|
| 8 |
-
"anthropic>=0.38.0",
|
| 9 |
-
"gradio>=5.4.0",
|
| 10 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
requirements.txt
CHANGED
|
@@ -1,2 +1,2 @@
|
|
| 1 |
-
gradio>=5.49.
|
| 2 |
-
anthropic
|
|
|
|
| 1 |
+
gradio>=5.49.1
|
| 2 |
+
anthropic>=0.38.0
|
uv.lock
DELETED
|
The diff for this file is too large to render.
See raw diff
|
|
|