Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -134,37 +134,15 @@ def extract_raw_text(output):
|
|
| 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 |
|
| 163 |
# Groq model
|
| 164 |
self.model = RetryOpenAIModel(
|
| 165 |
-
model_id="
|
| 166 |
-
api_base="https://
|
| 167 |
-
api_key=os.environ["
|
| 168 |
client_kwargs={
|
| 169 |
"timeout": 60.0,
|
| 170 |
"max_retries": 0
|
|
@@ -498,18 +476,6 @@ with gr.Blocks() as demo:
|
|
| 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)
|
|
|
|
| 134 |
|
| 135 |
raise TypeError(f"Unsupported output type: {type(output).__name__}")
|
| 136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
|
| 138 |
class BasicAgent:
|
| 139 |
def __init__(self):
|
| 140 |
|
| 141 |
# Groq model
|
| 142 |
self.model = RetryOpenAIModel(
|
| 143 |
+
model_id="openrouter/free",
|
| 144 |
+
api_base="https://openrouter.ai/api/v1",
|
| 145 |
+
api_key=os.environ["OPENROUTER_API_KEY"],
|
| 146 |
client_kwargs={
|
| 147 |
"timeout": 60.0,
|
| 148 |
"max_retries": 0
|
|
|
|
| 476 |
gr.LoginButton()
|
| 477 |
|
| 478 |
run_button = gr.Button("Run Evaluation & Submit All Answers")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 479 |
status_output = gr.Textbox(label="Run Status / Submission Result", lines=5, interactive=False)
|
| 480 |
# Removed max_rows=10 from DataFrame constructor
|
| 481 |
results_table = gr.DataFrame(label="Questions and Agent Answers", wrap=True)
|