ajayspot commited on
Commit
0152a60
·
verified ·
1 Parent(s): 3fabb74

Upload folder using huggingface_hub

Browse files
atomic_concepts_gradio/20250124_164753_angelone.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metrics_prompt": "Forget all of our past conversations and treat this as a new conversation. As an expert Data Analyst in the Financial Securities Trading Industry, parse the following question \"{question}\" and list all the metrics mentioned in the statement. Do not list anything that is not a metric. Do not include dimensions. ",
3
+ "dimensions_prompt": "Forget all of our past conversations and treat this as a new conversation. As an expert Data Analyst in the Financial Securities Trading Industry, parse the following question \"{question}\" and identify all the dimensions that are not a metric. List the dimensions including time period and list that only and nothing else. Do not include metrics.",
4
+ "results": [
5
+ {
6
+ "question": "What is the MTD total order volume",
7
+ "metrics": [
8
+ "MTD total order volume"
9
+ ],
10
+ "dimensions": [
11
+ "MTD",
12
+ "total order volume"
13
+ ]
14
+ },
15
+ {
16
+ "question": "Show total monthly order volume for the past 12 months.",
17
+ "metrics": [
18
+ "total monthly order volume"
19
+ ],
20
+ "dimensions": [
21
+ "order",
22
+ "time period (past 12 months)"
23
+ ]
24
+ }
25
+ ],
26
+ "llm_model": "gpt-4o",
27
+ "username": "achinta"
28
+ }
atomic_concepts_gradio/20250124_164947_angelone.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metrics_prompt": "Forget all of our past conversations and treat this as a new conversation. As an expert Data Analyst in the Financial Securities Trading Industry, parse the following question \"{question}\" and list all the metrics mentioned in the statement. Do not list anything that is not a metric. Do not include dimensions. ",
3
+ "dimensions_prompt": "Forget all of our past conversations and treat this as a new conversation. As an expert Data Analyst in the Financial Securities Trading Industry, parse the following question \"{question}\" and identify all the dimensions that are not a metric. List the dimensions including time period and list that only and nothing else. Do not include metrics.",
4
+ "results": [
5
+ {
6
+ "question": "What is the MTD total order volume",
7
+ "metrics": [
8
+ "MTD total order volume"
9
+ ],
10
+ "dimensions": [
11
+ "MTD (Month-to-Date)",
12
+ "order"
13
+ ]
14
+ },
15
+ {
16
+ "question": "Show total monthly order volume for the past 12 months.",
17
+ "metrics": [
18
+ "total monthly order volume"
19
+ ],
20
+ "dimensions": [
21
+ "monthly",
22
+ "past 12 months"
23
+ ]
24
+ }
25
+ ],
26
+ "llm_model": "gpt-4o",
27
+ "username": "achinta"
28
+ }
evaluate_atomic_matching.py CHANGED
@@ -29,7 +29,7 @@ def process_questions(llm_model: str, openai_api_Key: str, deploy_key: str, metr
29
  if not questions: missing_fields.append("Questions")
30
 
31
  if missing_fields:
32
- return f"Error: The following fields are mandatory and missing: {', '.join(missing_fields)}"
33
 
34
  # Set API key for LiteLLM
35
  os.environ["OPENAI_API_KEY"] = openai_api_Key
@@ -117,12 +117,13 @@ def process_questions(llm_model: str, openai_api_Key: str, deploy_key: str, metr
117
  # Clone into temporary directory
118
  repo = Repo.clone_from(repo_url, temp_dir)
119
 
120
- # Copy the new file to the cloned repo
121
- import shutil
122
- shutil.copy2(os.path.join(script_dir, filename), os.path.join(temp_dir, filename))
 
123
 
124
  # Add, commit and push from temporary directory
125
- repo.index.add([filename])
126
  repo.index.commit(f"Add evaluation results: {filename}")
127
  origin = repo.remote('origin')
128
  push_info = origin.push()
@@ -134,7 +135,7 @@ def process_questions(llm_model: str, openai_api_Key: str, deploy_key: str, metr
134
  # Construct GitHub web URL from SSH URL
135
  github_web_url = repo_url.replace("git@github.com:", "https://github.com/")
136
  github_web_url = github_web_url.replace(".git", "")
137
- file_url = f"{github_web_url}/blob/main/{filename}"
138
 
139
  finally:
140
  # Clean up
@@ -148,10 +149,10 @@ def process_questions(llm_model: str, openai_api_Key: str, deploy_key: str, metr
148
  )
149
  if error_messages:
150
  final_message += "\n\nErrors encountered:\n" + "\n".join(error_messages)
151
- return final_message
152
 
153
  except Exception as e:
154
- return f"Error pushing to repository: {str(e)}"
155
 
156
  # Create Gradio interface
157
  with gr.Blocks(css="footer {visibility: hidden}") as iface:
@@ -201,11 +202,31 @@ with gr.Blocks(css="footer {visibility: hidden}") as iface:
201
  with gr.Column(scale=1):
202
  questions = gr.Textbox(label="Questions (one per line)", lines=10, max_lines=10, info="Required")
203
  result = gr.Textbox(label="Result", lines=10, max_lines=10)
204
- gr.Button("Process").click(
 
 
 
 
 
 
 
 
 
 
205
  fn=process_questions,
206
  inputs=[model, api_key, deploy_key, metrics_prompt, dimensions_prompt, questions, customer_name],
207
- outputs=result,
208
  show_progress=True
 
 
 
 
 
 
 
 
 
 
209
  )
210
 
211
 
 
29
  if not questions: missing_fields.append("Questions")
30
 
31
  if missing_fields:
32
+ return f"Error: The following fields are mandatory and missing: {', '.join(missing_fields)}", None
33
 
34
  # Set API key for LiteLLM
35
  os.environ["OPENAI_API_KEY"] = openai_api_Key
 
117
  # Clone into temporary directory
118
  repo = Repo.clone_from(repo_url, temp_dir)
119
 
120
+ # Copy the new file to the cloned repo under atomic_concepts_gradio directory
121
+ repo_subdir = os.path.join(temp_dir, "atomic_concepts_gradio")
122
+ os.makedirs(repo_subdir, exist_ok=True)
123
+ shutil.copy2(filepath, os.path.join(repo_subdir, filename))
124
 
125
  # Add, commit and push from temporary directory
126
+ repo.index.add([os.path.join("atomic_concepts_gradio", filename)])
127
  repo.index.commit(f"Add evaluation results: {filename}")
128
  origin = repo.remote('origin')
129
  push_info = origin.push()
 
135
  # Construct GitHub web URL from SSH URL
136
  github_web_url = repo_url.replace("git@github.com:", "https://github.com/")
137
  github_web_url = github_web_url.replace(".git", "")
138
+ file_url = f"{github_web_url}/blob/main/atomic_concepts_gradio/{filename}"
139
 
140
  finally:
141
  # Clean up
 
149
  )
150
  if error_messages:
151
  final_message += "\n\nErrors encountered:\n" + "\n".join(error_messages)
152
+ return final_message, filepath
153
 
154
  except Exception as e:
155
+ return f"Error pushing to repository: {str(e)}", None
156
 
157
  # Create Gradio interface
158
  with gr.Blocks(css="footer {visibility: hidden}") as iface:
 
202
  with gr.Column(scale=1):
203
  questions = gr.Textbox(label="Questions (one per line)", lines=10, max_lines=10, info="Required")
204
  result = gr.Textbox(label="Result", lines=10, max_lines=10)
205
+ file_output = gr.State() # Add this to store the filepath
206
+
207
+ with gr.Row():
208
+ process_btn = gr.Button("Process")
209
+ download_btn = gr.Button("Download Results", interactive=False)
210
+
211
+ def enable_download(message, filepath):
212
+ download_btn.interactive = True
213
+ return message, filepath
214
+
215
+ process_btn.click(
216
  fn=process_questions,
217
  inputs=[model, api_key, deploy_key, metrics_prompt, dimensions_prompt, questions, customer_name],
218
+ outputs=[result, file_output],
219
  show_progress=True
220
+ ).then(
221
+ fn=enable_download,
222
+ inputs=[result, file_output],
223
+ outputs=[result, file_output]
224
+ )
225
+
226
+ download_btn.click(
227
+ fn=lambda filepath: filepath,
228
+ inputs=[file_output],
229
+ outputs=gr.File(label="Download JSON")
230
  )
231
 
232