Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -84,12 +84,41 @@ claude_3_models = {
|
|
84 |
}
|
85 |
|
86 |
gemini_models = {
|
87 |
-
|
88 |
-
"gemini-
|
89 |
-
"gemini-
|
90 |
-
"gemini-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
}
|
92 |
|
|
|
93 |
supported_image_models = {
|
94 |
"Flux Pro Ultra", "grok-2-aurora", "Flux Pro", "Flux Pro Ultra Raw",
|
95 |
"Flux Dev", "Flux Schnell", "stable-diffusion-3-large-turbo",
|
@@ -666,6 +695,12 @@ async def create_image(payload: ImageGenerationPayload, request: Request, authen
|
|
666 |
async def get_usage_json(days: int = 7):
|
667 |
return usage_tracker.get_usage_summary(days)
|
668 |
|
|
|
|
|
|
|
|
|
|
|
|
|
669 |
def generate_usage_html(usage_data: dict, days: int = 7):
|
670 |
model_labels = list(usage_data['model_usage_period'].keys())
|
671 |
model_counts = list(usage_data['model_usage_period'].values())
|
@@ -1244,4 +1279,3 @@ async def health_check():
|
|
1244 |
if __name__ == "__main__":
|
1245 |
import uvicorn
|
1246 |
uvicorn.run(app, host="0.0.0.0", port=7860)
|
1247 |
-
|
|
|
84 |
}
|
85 |
|
86 |
gemini_models = {
|
87 |
+
# Gemini 1.5 Series
|
88 |
+
"gemini-1.5-pro", # Alias for latest stable 1.5 Pro[4][5]
|
89 |
+
"gemini-1.5-pro-002", # Latest 1.5 Pro stable[4][5]
|
90 |
+
"gemini-1.5-flash", # Alias for latest stable 1.5 Flash[4][5]
|
91 |
+
"gemini-1.5-flash-002", # Latest 1.5 Flash stable[4][5]
|
92 |
+
"gemini-1.5-flash-8b", # 1.5 Flash 8B variant[1]
|
93 |
+
|
94 |
+
# Gemini 2.0 Series
|
95 |
+
"gemini-2.0-flash-lite", # Cost-efficient model[5]
|
96 |
+
"gemini-2.0-flash-lite-preview", # Preview version[1]
|
97 |
+
"gemini-2.0-flash", # Default model as of Jan 2025[5]
|
98 |
+
"gemini-2.0-flash-exp", # Experimental version[1]
|
99 |
+
"gemini-2.0-flash-thinking", # Exposes model reasoning[5]
|
100 |
+
"gemini-2.0-flash-thinking-exp-01-21", # Experimental thinking[1]
|
101 |
+
"gemini-2.0-flash-preview-image-generation", # Image generation[1]
|
102 |
+
"gemini-2.0-pro-exp-02-05", # 2.0 Pro Experimental[1]
|
103 |
+
|
104 |
+
# Gemini 2.5 Series
|
105 |
+
"gemini-2.5-flash", # Default model as of May 2025[5][7]
|
106 |
+
"gemini-2.5-flash-preview-05-20", # 2.5 Flash preview[3]
|
107 |
+
"gemini-2.5-flash-preview-native-audio-dialog", # Native audio output[3]
|
108 |
+
"gemini-2.5-flash-exp-native-audio-thinking-dialog", # Audio thinking[3]
|
109 |
+
"gemini-2.5-pro", # 2.5 Pro (active, most advanced)[6][7]
|
110 |
+
"gemini-2.5-pro-preview-06-05", # Latest 2.5 Pro preview[3]
|
111 |
+
"gemini-2.5-pro-preview-03-25", # 2.5 Pro preview[1][3]
|
112 |
+
"gemini-2.5-pro-exp-03-25", # 2.5 Pro experimental[3]
|
113 |
+
"gemini-2.5-pro-preview-tts", # Speech generation[3]
|
114 |
+
"gemini-2.5-flash-preview-tts", # Speech generation[3]
|
115 |
+
|
116 |
+
# Experimental and Special Models
|
117 |
+
"gemini-exp-1206", # Experimental 2.0 Pro[1]
|
118 |
+
"gemini-embedding-exp-03-07",# Experimental embeddings[3]
|
119 |
}
|
120 |
|
121 |
+
|
122 |
supported_image_models = {
|
123 |
"Flux Pro Ultra", "grok-2-aurora", "Flux Pro", "Flux Pro Ultra Raw",
|
124 |
"Flux Dev", "Flux Schnell", "stable-diffusion-3-large-turbo",
|
|
|
695 |
async def get_usage_json(days: int = 7):
|
696 |
return usage_tracker.get_usage_summary(days)
|
697 |
|
698 |
+
@app.get("/usage/page", response_class=HTMLResponse)
|
699 |
+
async def get_usage_page(days: int = Query(7, description="Number of days to include in the usage summary")):
|
700 |
+
usage_data = usage_tracker.get_usage_summary(days)
|
701 |
+
html_content = generate_usage_html(usage_data, days)
|
702 |
+
return HTMLResponse(content=html_content)
|
703 |
+
|
704 |
def generate_usage_html(usage_data: dict, days: int = 7):
|
705 |
model_labels = list(usage_data['model_usage_period'].keys())
|
706 |
model_counts = list(usage_data['model_usage_period'].values())
|
|
|
1279 |
if __name__ == "__main__":
|
1280 |
import uvicorn
|
1281 |
uvicorn.run(app, host="0.0.0.0", port=7860)
|
|