Spaces:
Running
on
T4
Running
on
T4
updated api sourced
Browse files
app.py
CHANGED
@@ -184,13 +184,10 @@ class Solver:
|
|
184 |
yield messages
|
185 |
|
186 |
|
187 |
-
|
188 |
-
|
189 |
def parse_arguments():
|
190 |
parser = argparse.ArgumentParser(description="Run the OctoTools demo with specified parameters.")
|
191 |
parser.add_argument("--llm_engine_name", default="gpt-4o", help="LLM engine name.")
|
192 |
parser.add_argument("--max_tokens", type=int, default=2000, help="Maximum tokens for LLM generation.")
|
193 |
-
parser.add_argument("--run_baseline_only", type=bool, default=False, help="Run only the baseline (no toolbox).")
|
194 |
parser.add_argument("--task", default="minitoolbench", help="Task to run.")
|
195 |
parser.add_argument("--task_description", default="", help="Task description.")
|
196 |
parser.add_argument(
|
@@ -203,6 +200,7 @@ def parse_arguments():
|
|
203 |
parser.add_argument("--verbose", type=bool, default=True, help="Enable verbose output.")
|
204 |
|
205 |
# NOTE: Add new arguments
|
|
|
206 |
parser.add_argument("--openai_api_source", default="we_provided", choices=["we_provided", "user_provided"], help="Source of OpenAI API key.")
|
207 |
return parser.parse_args()
|
208 |
|
@@ -214,7 +212,7 @@ def solve_problem_gradio(user_query, user_image, max_steps=10, max_time=60, api_
|
|
214 |
"""
|
215 |
|
216 |
# Generate shorter ID (Date and first 8 characters of UUID)
|
217 |
-
query_id = time.strftime("%Y%m%d_%H%M%S") + "_" + str(uuid.uuid4())[:8] # e.g,
|
218 |
print(f"Query ID: {query_id}")
|
219 |
|
220 |
# Create a directory for the query ID
|
@@ -303,13 +301,22 @@ def main(args):
|
|
303 |
# Left column for settings
|
304 |
with gr.Column(scale=1):
|
305 |
with gr.Row():
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
313 |
|
314 |
with gr.Row():
|
315 |
llm_model_engine = gr.Dropdown(
|
@@ -371,8 +378,8 @@ def main(args):
|
|
371 |
with gr.Row(elem_id="buttons") as button_row:
|
372 |
upvote_btn = gr.Button(value="π Upvote", interactive=True, variant="primary") # TODO
|
373 |
downvote_btn = gr.Button(value="π Downvote", interactive=True, variant="primary") # TODO
|
374 |
-
stop_btn = gr.Button(value="βοΈ Stop", interactive=True) # TODO
|
375 |
-
clear_btn = gr.Button(value="ποΈ Clear history", interactive=True) # TODO
|
376 |
|
377 |
# TODO: Add comment textbox
|
378 |
with gr.Row():
|
|
|
184 |
yield messages
|
185 |
|
186 |
|
|
|
|
|
187 |
def parse_arguments():
|
188 |
parser = argparse.ArgumentParser(description="Run the OctoTools demo with specified parameters.")
|
189 |
parser.add_argument("--llm_engine_name", default="gpt-4o", help="LLM engine name.")
|
190 |
parser.add_argument("--max_tokens", type=int, default=2000, help="Maximum tokens for LLM generation.")
|
|
|
191 |
parser.add_argument("--task", default="minitoolbench", help="Task to run.")
|
192 |
parser.add_argument("--task_description", default="", help="Task description.")
|
193 |
parser.add_argument(
|
|
|
200 |
parser.add_argument("--verbose", type=bool, default=True, help="Enable verbose output.")
|
201 |
|
202 |
# NOTE: Add new arguments
|
203 |
+
parser.add_argument("--run_baseline_only", type=bool, default=False, help="Run only the baseline (no toolbox).")
|
204 |
parser.add_argument("--openai_api_source", default="we_provided", choices=["we_provided", "user_provided"], help="Source of OpenAI API key.")
|
205 |
return parser.parse_args()
|
206 |
|
|
|
212 |
"""
|
213 |
|
214 |
# Generate shorter ID (Date and first 8 characters of UUID)
|
215 |
+
query_id = time.strftime("%Y%m%d_%H%M%S") + "_" + str(uuid.uuid4())[:8] # e.g, 20250217_062225_612f2474
|
216 |
print(f"Query ID: {query_id}")
|
217 |
|
218 |
# Create a directory for the query ID
|
|
|
301 |
# Left column for settings
|
302 |
with gr.Column(scale=1):
|
303 |
with gr.Row():
|
304 |
+
if args.openai_api_source == "user_provided":
|
305 |
+
print("Using API key from user input.")
|
306 |
+
api_key = gr.Textbox(
|
307 |
+
show_label=True,
|
308 |
+
placeholder="Your API key will not be stored in any way.",
|
309 |
+
type="password",
|
310 |
+
label="OpenAI API Key",
|
311 |
+
# container=False
|
312 |
+
)
|
313 |
+
else:
|
314 |
+
print(f"Using local API key from environment variable: {os.getenv('OPENAI_API_KEY')[:4]}...")
|
315 |
+
api_key = gr.Textbox(
|
316 |
+
value=os.getenv("OPENAI_API_KEY"),
|
317 |
+
visible=False,
|
318 |
+
interactive=False
|
319 |
+
)
|
320 |
|
321 |
with gr.Row():
|
322 |
llm_model_engine = gr.Dropdown(
|
|
|
378 |
with gr.Row(elem_id="buttons") as button_row:
|
379 |
upvote_btn = gr.Button(value="π Upvote", interactive=True, variant="primary") # TODO
|
380 |
downvote_btn = gr.Button(value="π Downvote", interactive=True, variant="primary") # TODO
|
381 |
+
# stop_btn = gr.Button(value="βοΈ Stop", interactive=True) # TODO
|
382 |
+
# clear_btn = gr.Button(value="ποΈ Clear history", interactive=True) # TODO
|
383 |
|
384 |
# TODO: Add comment textbox
|
385 |
with gr.Row():
|