mixed-modality-search commited on
Commit
09df82b
·
1 Parent(s): ec99498
Files changed (1) hide show
  1. main.py +22 -21
main.py CHANGED
@@ -107,34 +107,35 @@ def process_json(file):
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": [
114
- {"query_id": "1", "corpus_top_100_list": "5, 2, 8, ..."},
115
- {"query_id": "2", "corpus_top_100_list": "90, 13, 3, ..."}
116
- ],
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__":
 
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
  def main_gradio():
111
+ example_json_html = (
112
+ '{<br>'
113
+ '&nbsp;&nbsp;"Google_WIT": [<br>'
114
+ '&nbsp;&nbsp;&nbsp;&nbsp;{"query_id": "1", "corpus_top_100_list": "5, 2, 8, ..."},<br>'
115
+ '&nbsp;&nbsp;&nbsp;&nbsp;{"query_id": "2", "corpus_top_100_list": "90, 13, 3, ..."}<br>'
116
+ '&nbsp;&nbsp;],<br>'
117
+ '&nbsp;&nbsp;"MSCOCO": [<br>'
118
+ '&nbsp;&nbsp;&nbsp;&nbsp;{"query_id": "3", "corpus_top_100_list": "122, 35, 22, ..."},<br>'
119
+ '&nbsp;&nbsp;&nbsp;&nbsp;{"query_id": "2", "corpus_top_100_list": "90, 19, 3, ..."}<br>'
120
+ '&nbsp;&nbsp;],<br>'
121
+ '&nbsp;&nbsp;"OVEN": [<br>'
122
+ '&nbsp;&nbsp;&nbsp;&nbsp;{"query_id": "3", "corpus_top_100_list": "11, 15, 22, ..."}<br>'
123
+ '&nbsp;&nbsp;],<br>'
124
+ '&nbsp;&nbsp;"VisualNews": [<br>'
125
+ '&nbsp;&nbsp;&nbsp;&nbsp;{"query_id": "3", "corpus_top_100_list": "101, 35, 22, ..."}<br>'
126
+ '&nbsp;&nbsp;]<br>'
127
+ '}'
128
+ )
129
 
130
  gr.Interface(
131
  fn=process_json,
132
  inputs=gr.File(label="Upload Retrieval Result (JSON)"),
133
  outputs=gr.Textbox(label="Results"),
134
  title="Automated Evaluation of MixBench",
135
+ description=(
136
+ "Upload a prediction JSON to evaluate Recall@1, NDCG@10, and NDCG@100 against encrypted qrels.<br><br>"
137
+ "Example input format:<br><br>" + example_json_html
138
+ )
139
  ).launch(share=True)
140
 
141
  if __name__ == "__main__":