mixed-modality-search commited on
Commit
ec99498
·
1 Parent(s): 6eb346b
Files changed (1) hide show
  1. main.py +32 -3
main.py CHANGED
@@ -83,6 +83,31 @@ def process_json(file):
83
  return f"Error during evaluation: {str(e)}"
84
 
85
  # ==== Launch Gradio App ====
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  def main_gradio():
87
  example_json = '''{
88
  "Google_WIT": [
@@ -92,20 +117,24 @@ def main_gradio():
92
  "MSCOCO": [
93
  {"query_id": "3", "corpus_top_100_list": "122, 35, 22, ..."},
94
  {"query_id": "2", "corpus_top_100_list": "90, 19, 3, ..."}
95
- ]
96
  "OVEN": [
97
  {"query_id": "3", "corpus_top_100_list": "11, 15, 22, ..."}
98
- ]
99
  "VisualNews": [
100
  {"query_id": "3", "corpus_top_100_list": "101, 35, 22, ..."}
101
  ]
102
  }'''
 
 
 
103
  gr.Interface(
104
  fn=process_json,
105
  inputs=gr.File(label="Upload Retrieval Result (JSON)"),
106
  outputs=gr.Textbox(label="Results"),
107
  title="Automated Evaluation of MixBench",
108
- description="Upload a prediction JSON to evaluate Recall@1, NDCG@10, and NDCG@100 against encrypted qrels.\n\nExample input:\n" + example_json
 
109
  ).launch(share=True)
110
 
111
  if __name__ == "__main__":
 
83
  return f"Error during evaluation: {str(e)}"
84
 
85
  # ==== Launch Gradio App ====
86
+ # def main_gradio():
87
+ # example_json = '''{
88
+ # "Google_WIT": [
89
+ # {"query_id": "1", "corpus_top_100_list": "5, 2, 8, ..."},
90
+ # {"query_id": "2", "corpus_top_100_list": "90, 13, 3, ..."}
91
+ # ],
92
+ # "MSCOCO": [
93
+ # {"query_id": "3", "corpus_top_100_list": "122, 35, 22, ..."},
94
+ # {"query_id": "2", "corpus_top_100_list": "90, 19, 3, ..."}
95
+ # ]
96
+ # "OVEN": [
97
+ # {"query_id": "3", "corpus_top_100_list": "11, 15, 22, ..."}
98
+ # ]
99
+ # "VisualNews": [
100
+ # {"query_id": "3", "corpus_top_100_list": "101, 35, 22, ..."}
101
+ # ]
102
+ # }'''
103
+ # gr.Interface(
104
+ # fn=process_json,
105
+ # inputs=gr.File(label="Upload Retrieval Result (JSON)"),
106
+ # outputs=gr.Textbox(label="Results"),
107
+ # title="Automated Evaluation of MixBench",
108
+ # description="Upload a prediction JSON to evaluate Recall@1, NDCG@10, and NDCG@100 against encrypted qrels.\n\nExample input:\n" + example_json
109
+ # ).launch(share=True)
110
+
111
  def main_gradio():
112
  example_json = '''{
113
  "Google_WIT": [
 
117
  "MSCOCO": [
118
  {"query_id": "3", "corpus_top_100_list": "122, 35, 22, ..."},
119
  {"query_id": "2", "corpus_top_100_list": "90, 19, 3, ..."}
120
+ ],
121
  "OVEN": [
122
  {"query_id": "3", "corpus_top_100_list": "11, 15, 22, ..."}
123
+ ],
124
  "VisualNews": [
125
  {"query_id": "3", "corpus_top_100_list": "101, 35, 22, ..."}
126
  ]
127
  }'''
128
+ # Convert \n to <br> and wrap example in <pre> to preserve indentation
129
+ formatted_example = f"<pre>{example_json}</pre>"
130
+
131
  gr.Interface(
132
  fn=process_json,
133
  inputs=gr.File(label="Upload Retrieval Result (JSON)"),
134
  outputs=gr.Textbox(label="Results"),
135
  title="Automated Evaluation of MixBench",
136
+ description="Upload a prediction JSON to evaluate Recall@1, NDCG@10, and NDCG@100 against encrypted qrels.<br><br>"
137
+ "Example input format:<br>" + formatted_example
138
  ).launch(share=True)
139
 
140
  if __name__ == "__main__":