Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,9 +1,11 @@
|
|
| 1 |
-
|
| 2 |
import gradio as gr
|
| 3 |
import requests
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
from agent import *
|
|
|
|
|
|
|
| 7 |
|
| 8 |
# (Keep Constants as is)
|
| 9 |
# --- Constants ---
|
|
@@ -144,7 +146,14 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 144 |
results_df = pd.DataFrame(results_log)
|
| 145 |
return status_message, results_df
|
| 146 |
|
| 147 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
# --- Build Gradio Interface using Blocks ---
|
| 149 |
with gr.Blocks() as demo:
|
| 150 |
gr.Markdown("# Basic Agent Evaluation Runner")
|
|
@@ -172,8 +181,8 @@ with gr.Blocks() as demo:
|
|
| 172 |
results_table = gr.DataFrame(label="Questions and Agent Answers", wrap=True)
|
| 173 |
|
| 174 |
run_button.click(
|
| 175 |
-
fn=
|
| 176 |
-
outputs=[status_output, results_table]
|
| 177 |
)
|
| 178 |
|
| 179 |
if __name__ == "__main__":
|
|
@@ -199,10 +208,5 @@ if __name__ == "__main__":
|
|
| 199 |
|
| 200 |
print("Launching Gradio Interface for Basic Agent Evaluation...")
|
| 201 |
demo.launch(debug=True, share=False)
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
import os
|
| 205 |
-
if __name__ == "__main__":
|
| 206 |
-
if not os.path.exists("chroma_db"):
|
| 207 |
-
with zipfile.ZipFile("chroma_db.zip", 'r') as zip_ref:
|
| 208 |
-
zip_ref.extractall(".")
|
|
|
|
| 1 |
+
import os
|
| 2 |
import gradio as gr
|
| 3 |
import requests
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
from agent import *
|
| 7 |
+
import zipfile
|
| 8 |
+
import os
|
| 9 |
|
| 10 |
# (Keep Constants as is)
|
| 11 |
# --- Constants ---
|
|
|
|
| 146 |
results_df = pd.DataFrame(results_log)
|
| 147 |
return status_message, results_df
|
| 148 |
|
| 149 |
+
def unzip_on_startup():
|
| 150 |
+
zip_path = "file.zip"
|
| 151 |
+
extract_dir = "chroma_db"
|
| 152 |
+
if not os.path.exists(extract_dir):
|
| 153 |
+
with zipfile.ZipFile(zip_path, 'r') as zip_ref:
|
| 154 |
+
zip_ref.extractall(extract_dir)
|
| 155 |
+
raise Exception('fatto')
|
| 156 |
+
|
| 157 |
# --- Build Gradio Interface using Blocks ---
|
| 158 |
with gr.Blocks() as demo:
|
| 159 |
gr.Markdown("# Basic Agent Evaluation Runner")
|
|
|
|
| 181 |
results_table = gr.DataFrame(label="Questions and Agent Answers", wrap=True)
|
| 182 |
|
| 183 |
run_button.click(
|
| 184 |
+
fn=unzip_on_startup,
|
| 185 |
+
#outputs=[status_output, results_table]
|
| 186 |
)
|
| 187 |
|
| 188 |
if __name__ == "__main__":
|
|
|
|
| 208 |
|
| 209 |
print("Launching Gradio Interface for Basic Agent Evaluation...")
|
| 210 |
demo.launch(debug=True, share=False)
|
| 211 |
+
|
| 212 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|