MCPcopy Create free account
hub / github.com/abetlen/llama-cpp-python / get_user_choice

Function get_user_choice

docker/open_llama/hug_model.py:51–71  ·  view source on GitHub ↗
(model_list)

Source from the content-addressed store, hash-verified

49 print(f"Download failed with status code {response.status_code}")
50
51def get_user_choice(model_list):
52 # Print the enumerated list
53 print("\n")
54 for i, (model_id, rfilename) in enumerate(model_list):
55 print(f"{i+1}: Model ID: {model_id}, RFilename: {rfilename}")
56
57 # Get user's choice
58 choice = input("Choose a model to download by entering the corresponding number: ")
59 try:
60 index = int(choice) - 1
61 if 0 <= index < len(model_list):
62 # Return the chosen model
63 return model_list[index]
64 else:
65 print("Invalid choice.")
66 except ValueError:
67 print("Invalid input. Please enter a number corresponding to a model.")
68 except IndexError:
69 print("Invalid choice. Index out of range.")
70
71 return None
72
73def main():
74 # Create an argument parser

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…