Spaces:
Running
Running
Update app.py
Browse filesAdded JSON Upload functionality + button
Added instructions for user to submit pull requests
app.py
CHANGED
@@ -435,9 +435,29 @@ class AIEvaluationForm:
|
|
435 |
fn=load_example,
|
436 |
outputs=all_inputs
|
437 |
)
|
438 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
439 |
return demo
|
440 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
441 |
def main():
|
442 |
"""Main function to run the application"""
|
443 |
try:
|
|
|
435 |
fn=load_example,
|
436 |
outputs=all_inputs
|
437 |
)
|
438 |
+
with gr.Group():
|
439 |
+
gr.Markdown("### 📤 Upload Completed Evaluation JSON")
|
440 |
+
uploaded_file = gr.File(label="Upload JSON File", file_types=[".json"])
|
441 |
+
uploaded_preview = gr.JSON(label="Preview of Uploaded Content")
|
442 |
+
uploaded_file.change(fn=load_uploaded_json, inputs=uploaded_file, outputs=uploaded_preview)
|
443 |
+
|
444 |
+
gr.Markdown("""
|
445 |
+
### \ud83d\udcec Submit Your Scorecard to the Eval Cards Repository
|
446 |
+
Once downloaded, you can contribute by submitting a pull request to [Eval Cards GitHub](https://github.com/evaleval/Eval_Cards).
|
447 |
+
Place your file in the `submissions/` directory.
|
448 |
+
""")
|
449 |
+
|
450 |
return demo
|
451 |
|
452 |
+
def load_uploaded_json(file):
|
453 |
+
if file is None:
|
454 |
+
return {}
|
455 |
+
try:
|
456 |
+
with open(file.name, 'r') as f:
|
457 |
+
return json.load(f)
|
458 |
+
except Exception as e:
|
459 |
+
return {"error": str(e)}
|
460 |
+
|
461 |
def main():
|
462 |
"""Main function to run the application"""
|
463 |
try:
|