bstraehle commited on
Commit
c000561
·
verified ·
1 Parent(s): 4af37d5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -2
app.py CHANGED
@@ -54,6 +54,12 @@ def ask(question, openai_api_key, gemini_api_key, anthropic_api_key, file_name =
54
  for key in ["OPENAI_API_KEY", "GEMINI_API_KEY", "MODEL_API_KEY"]:
55
  os.environ.pop(key, None)
56
 
 
 
 
 
 
 
57
  with gr.Blocks() as gaia:
58
  gr.Markdown("## General AI Assistant")
59
 
@@ -75,7 +81,13 @@ with gr.Blocks() as gaia:
75
  )
76
  file_name = gr.Textbox(
77
  label="File Name",
78
- interactive=True
 
 
 
 
 
 
79
  )
80
  with gr.Row():
81
  openai_api_key = gr.Textbox(
@@ -97,7 +109,7 @@ with gr.Blocks() as gaia:
97
  )
98
  with gr.Row():
99
  clear_btn = gr.ClearButton(
100
- components=[question, ground_truth, file_name]
101
  )
102
  submit_btn = gr.Button("Submit", variant="primary")
103
  with gr.Column(scale=1):
@@ -112,6 +124,12 @@ with gr.Blocks() as gaia:
112
  outputs=answer
113
  )
114
 
 
 
 
 
 
 
115
  gr.Examples(
116
  label="Humanity's Last Exam Problems",
117
  examples=get_questions(QUESTION_FILE_PATH_HLE, 0),
 
54
  for key in ["OPENAI_API_KEY", "GEMINI_API_KEY", "MODEL_API_KEY"]:
55
  os.environ.pop(key, None)
56
 
57
+ def update_file_link(file_name):
58
+ if file_name:
59
+ return f"files/{file_name}"
60
+
61
+ return None
62
+
63
  with gr.Blocks() as gaia:
64
  gr.Markdown("## General AI Assistant")
65
 
 
81
  )
82
  file_name = gr.Textbox(
83
  label="File Name",
84
+ interactive=True,
85
+ scale=2
86
+ )
87
+ file_link = gr.File(
88
+ label="File",
89
+ interactive=False,
90
+ scale=1
91
  )
92
  with gr.Row():
93
  openai_api_key = gr.Textbox(
 
109
  )
110
  with gr.Row():
111
  clear_btn = gr.ClearButton(
112
+ components=[question, ground_truth, file_name, file_link]
113
  )
114
  submit_btn = gr.Button("Submit", variant="primary")
115
  with gr.Column(scale=1):
 
124
  outputs=answer
125
  )
126
 
127
+ file_name.change(
128
+ fn=update_file_link,
129
+ inputs=[file_name],
130
+ outputs=[file_link]
131
+ )
132
+
133
  gr.Examples(
134
  label="Humanity's Last Exam Problems",
135
  examples=get_questions(QUESTION_FILE_PATH_HLE, 0),