Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,6 +5,7 @@ import inspect
|
|
| 5 |
import pandas as pd
|
| 6 |
import json
|
| 7 |
import time
|
|
|
|
| 8 |
from openai import RateLimitError
|
| 9 |
from pathlib import Path
|
| 10 |
from smolagents import (
|
|
@@ -133,6 +134,29 @@ def extract_raw_text(output):
|
|
| 133 |
|
| 134 |
raise TypeError(f"Unsupported output type: {type(output).__name__}")
|
| 135 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
class BasicAgent:
|
| 137 |
def __init__(self):
|
| 138 |
|
|
@@ -474,7 +498,18 @@ with gr.Blocks() as demo:
|
|
| 474 |
gr.LoginButton()
|
| 475 |
|
| 476 |
run_button = gr.Button("Run Evaluation & Submit All Answers")
|
|
|
|
| 477 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 478 |
status_output = gr.Textbox(label="Run Status / Submission Result", lines=5, interactive=False)
|
| 479 |
# Removed max_rows=10 from DataFrame constructor
|
| 480 |
results_table = gr.DataFrame(label="Questions and Agent Answers", wrap=True)
|
|
|
|
| 5 |
import pandas as pd
|
| 6 |
import json
|
| 7 |
import time
|
| 8 |
+
from groq import Groq
|
| 9 |
from openai import RateLimitError
|
| 10 |
from pathlib import Path
|
| 11 |
from smolagents import (
|
|
|
|
| 134 |
|
| 135 |
raise TypeError(f"Unsupported output type: {type(output).__name__}")
|
| 136 |
|
| 137 |
+
def list_groq_models():
|
| 138 |
+
try:
|
| 139 |
+
client = Groq(
|
| 140 |
+
api_key=os.environ["GROQ_API_KEY"],
|
| 141 |
+
timeout=20.0,
|
| 142 |
+
max_retries=0
|
| 143 |
+
)
|
| 144 |
+
|
| 145 |
+
models = client.models.list()
|
| 146 |
+
|
| 147 |
+
model_ids = sorted(model.id for model in models.data)
|
| 148 |
+
|
| 149 |
+
print("\n========== GROQ AVAILABLE MODELS ==========")
|
| 150 |
+
for model_id in model_ids:
|
| 151 |
+
print(model_id)
|
| 152 |
+
print("===========================================\n")
|
| 153 |
+
|
| 154 |
+
return "\n".join(model_ids)
|
| 155 |
+
|
| 156 |
+
except Exception as e:
|
| 157 |
+
print(f"Failed to list Groq models: {e}")
|
| 158 |
+
return f"Error: {e}"
|
| 159 |
+
|
| 160 |
class BasicAgent:
|
| 161 |
def __init__(self):
|
| 162 |
|
|
|
|
| 498 |
gr.LoginButton()
|
| 499 |
|
| 500 |
run_button = gr.Button("Run Evaluation & Submit All Answers")
|
| 501 |
+
check_models_btn = gr.Button("Check Groq Models")
|
| 502 |
|
| 503 |
+
models_output = gr.Textbox(
|
| 504 |
+
label="Available Groq Models",
|
| 505 |
+
lines=12
|
| 506 |
+
)
|
| 507 |
+
|
| 508 |
+
check_models_btn.click(
|
| 509 |
+
fn=list_groq_models,
|
| 510 |
+
inputs=[],
|
| 511 |
+
outputs=models_output
|
| 512 |
+
)
|
| 513 |
status_output = gr.Textbox(label="Run Status / Submission Result", lines=5, interactive=False)
|
| 514 |
# Removed max_rows=10 from DataFrame constructor
|
| 515 |
results_table = gr.DataFrame(label="Questions and Agent Answers", wrap=True)
|