Skip to content

Commit

Permalink
chore: set model based on being in HF Space or not (presumed local)
Browse files Browse the repository at this point in the history
  • Loading branch information
kurisu committed Oct 14, 2024
1 parent 33bb2de commit 6b088d7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
sessions_path = "sessions.pkl"
sessions = pickle.load(open(sessions_path, "rb")) if os.path.exists(sessions_path) else {}

agent = get_agent(model_name="meta-llama/Meta-Llama-3.1-8B-Instruct", include_image_tools=True)
# If currently hosted on HuggingFace Spaces, use the default model, otherwise use the local model
model_name = "meta-llama/Meta-Llama-3.1-8B-Instruct" if os.getenv("SPACE_ID") is not None else "http://localhost:1234/v1"

agent = get_agent(model_name=model_name, include_image_tools=True)

app = None

Expand Down

0 comments on commit 6b088d7

Please sign in to comment.