Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -40,7 +40,7 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 40 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 41 |
|
| 42 |
|
| 43 |
-
|
| 44 |
def run_blast(arguments_string: str) -> str:
|
| 45 |
"""Submits a BLAST job to NCBI and retrieves the results.
|
| 46 |
|
|
@@ -162,9 +162,8 @@ def run_blast(arguments_string: str) -> str:
|
|
| 162 |
return result_response.text
|
| 163 |
|
| 164 |
if __name__ == "__main__":
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
arguments_string = " ".join(sys.argv[1:]) # Reconstruct arguments string from command line
|
| 168 |
results = run_blast(arguments_string)
|
| 169 |
|
| 170 |
if results.startswith("Error:"):
|
|
@@ -182,7 +181,7 @@ if __name__ == "__main__":
|
|
| 182 |
else:
|
| 183 |
print(results)
|
| 184 |
sys.exit(0)
|
| 185 |
-
|
| 186 |
print("This script is intended to be used as a tool function.", file=sys.stderr)
|
| 187 |
print("When run directly, it requires command-line arguments:", file=sys.stderr)
|
| 188 |
print("Usage: python blast_tool.py program database query_sequence", file=sys.stderr)
|
|
|
|
| 40 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 41 |
|
| 42 |
|
| 43 |
+
@@tool
|
| 44 |
def run_blast(arguments_string: str) -> str:
|
| 45 |
"""Submits a BLAST job to NCBI and retrieves the results.
|
| 46 |
|
|
|
|
| 162 |
return result_response.text
|
| 163 |
|
| 164 |
if __name__ == "__main__":
|
| 165 |
+
if len(sys.argv) > 3: # Expecting at least program, database, and query
|
| 166 |
+
arguments_string = " ".join(sys.argv[1:])
|
|
|
|
| 167 |
results = run_blast(arguments_string)
|
| 168 |
|
| 169 |
if results.startswith("Error:"):
|
|
|
|
| 181 |
else:
|
| 182 |
print(results)
|
| 183 |
sys.exit(0)
|
| 184 |
+
else: # Run directly but without enough arguments (or no arguments)
|
| 185 |
print("This script is intended to be used as a tool function.", file=sys.stderr)
|
| 186 |
print("When run directly, it requires command-line arguments:", file=sys.stderr)
|
| 187 |
print("Usage: python blast_tool.py program database query_sequence", file=sys.stderr)
|