Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -19,6 +19,20 @@ class BasicAgent:
|
|
19 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
20 |
return fixed_answer
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
23 |
"""
|
24 |
Fetches all questions, runs the BasicAgent on them, submits all answers,
|
@@ -27,6 +41,8 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
27 |
# --- Determine HF Space Runtime URL and Repo URL ---
|
28 |
space_id = os.getenv("SPACE_ID") # Get the SPACE_ID for sending link to the code
|
29 |
|
|
|
|
|
30 |
if profile:
|
31 |
username= f"{profile.username}"
|
32 |
print(f"User logged in: {username}")
|
|
|
19 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
20 |
return fixed_answer
|
21 |
|
22 |
+
def check_ffmpeg_installed():
|
23 |
+
try:
|
24 |
+
# Run the ffmpeg command to check the version
|
25 |
+
result = subprocess.run(['ffmpeg', '-version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
26 |
+
|
27 |
+
# If ffmpeg is installed, the version information will be in the output
|
28 |
+
if result.returncode == 0:
|
29 |
+
return True, result.stdout # Return True and the version info
|
30 |
+
else:
|
31 |
+
return False, result.stderr # Return False and error message if ffmpeg is not found
|
32 |
+
except FileNotFoundError:
|
33 |
+
# If ffmpeg is not installed or the command isn't found
|
34 |
+
return False, "ffmpeg not installed"
|
35 |
+
|
36 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
37 |
"""
|
38 |
Fetches all questions, runs the BasicAgent on them, submits all answers,
|
|
|
41 |
# --- Determine HF Space Runtime URL and Repo URL ---
|
42 |
space_id = os.getenv("SPACE_ID") # Get the SPACE_ID for sending link to the code
|
43 |
|
44 |
+
print('ffmpeg installed? ' + check_ffmpeg_installed())
|
45 |
+
|
46 |
if profile:
|
47 |
username= f"{profile.username}"
|
48 |
print(f"User logged in: {username}")
|