print the git hash
Browse files
app.py
CHANGED
@@ -1,8 +1,10 @@
|
|
1 |
import base64
|
2 |
import os
|
3 |
-
import gradio as gr
|
4 |
import requests
|
|
|
5 |
import inspect
|
|
|
|
|
6 |
import pandas as pd
|
7 |
|
8 |
import basic_agent
|
@@ -44,6 +46,15 @@ tracer = trace.get_tracer(__name__)
|
|
44 |
SmolagentsInstrumentor().instrument(tracer_provider=trace_provider)
|
45 |
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
def run_and_submit_all(profile: gr.OAuthProfile | None):
|
48 |
"""
|
49 |
Fetches all questions, runs the basic_agent.BasicAgent on them, submits all answers,
|
@@ -60,6 +71,9 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
|
|
60 |
print("User not logged in.")
|
61 |
return "Please Login to Hugging Face with the button.", None
|
62 |
|
|
|
|
|
|
|
63 |
api_url = DEFAULT_API_URL
|
64 |
questions_url = f"{api_url}/questions"
|
65 |
submit_url = f"{api_url}/submit"
|
@@ -105,7 +119,7 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
|
|
105 |
filename = item.get("file_name")
|
106 |
if filename:
|
107 |
file_url = f"{api_url}/files/{task_id}"
|
108 |
-
print("Question {task_id=} has attachment: {file_url=}")
|
109 |
quest_with_url = f"{question_text}\nFile url: {file_url}"
|
110 |
else:
|
111 |
quest_with_url = question_text
|
|
|
1 |
import base64
|
2 |
import os
|
|
|
3 |
import requests
|
4 |
+
import subprocess
|
5 |
import inspect
|
6 |
+
|
7 |
+
import gradio as gr
|
8 |
import pandas as pd
|
9 |
|
10 |
import basic_agent
|
|
|
46 |
SmolagentsInstrumentor().instrument(tracer_provider=trace_provider)
|
47 |
|
48 |
|
49 |
+
def get_git_hash():
|
50 |
+
try:
|
51 |
+
process = subprocess.run(['git', 'rev-parse', 'HEAD'], capture_output=True, text=True, check=True)
|
52 |
+
git_hash = process.stdout.strip()
|
53 |
+
return git_hash
|
54 |
+
except subprocess.CalledProcessError as e:
|
55 |
+
print(f"Error: {e}")
|
56 |
+
return None
|
57 |
+
|
58 |
def run_and_submit_all(profile: gr.OAuthProfile | None):
|
59 |
"""
|
60 |
Fetches all questions, runs the basic_agent.BasicAgent on them, submits all answers,
|
|
|
71 |
print("User not logged in.")
|
72 |
return "Please Login to Hugging Face with the button.", None
|
73 |
|
74 |
+
git_hash = get_git_hash()
|
75 |
+
print("-"*6 + f"> {git_hash=} <" + "-"*6)
|
76 |
+
|
77 |
api_url = DEFAULT_API_URL
|
78 |
questions_url = f"{api_url}/questions"
|
79 |
submit_url = f"{api_url}/submit"
|
|
|
119 |
filename = item.get("file_name")
|
120 |
if filename:
|
121 |
file_url = f"{api_url}/files/{task_id}"
|
122 |
+
print(f"Question {task_id=} has attachment: {file_url=}")
|
123 |
quest_with_url = f"{question_text}\nFile url: {file_url}"
|
124 |
else:
|
125 |
quest_with_url = question_text
|