Parcourir la source

fix the extra line added and remove take prompt from cli

Hamid Shojanazeri il y a 1 an
Parent
commit
75991d8795
1 fichiers modifiés avec 1 ajouts et 3 suppressions
  1. 1 3
      inference/code-llama/code_completion_example.py

+ 1 - 3
inference/code-llama/code_completion_example.py

@@ -42,9 +42,7 @@ def main(
             prompt_file
         ), f"Provided Prompt file does not exist {prompt_file}"
         with open(prompt_file, "r") as f:
-            user_prompt = "\n".join(f.readlines())
-    elif not sys.stdin.isatty():
-        user_prompt = "\n".join(sys.stdin.readlines())
+            user_prompt = f.read()
     else:
         print("No user prompt provided. Exiting.")
         sys.exit(1)