reddmann007 commited on
Commit
bc3fce8
·
verified ·
1 Parent(s): ef59653

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -8
app.py CHANGED
@@ -10,25 +10,24 @@ st.title("🤖 ShotCaller: Prompt Lab")
10
  st.markdown("Explore how different prompting techniques change AI reasoning.")
11
 
12
  # --- 2. Model Setup ---
13
- # Retrieve your token from Hugging Face Settings > Secrets
14
  api_token = os.getenv("HUGGINGFACEHUB_API_TOKEN")
15
 
16
  if not api_token:
17
  st.error("Missing HUGGINGFACEHUB_API_TOKEN. Add it to your Space Secrets!")
18
  st.stop()
19
 
20
- # Initialize the endpoint
21
- # Note: task="text-generation" is required for the underlying class,
22
- # but ChatHuggingFace will handle the conversational routing.
23
- repo_id = "mistralai/Mistral-7B-Instruct-v0.3"
24
  llm = HuggingFaceEndpoint(
25
  repo_id=repo_id,
26
- task="text-generation",
27
  temperature=0.7,
28
- huggingfacehub_api_token=api_token
 
29
  )
30
 
31
- # Wrap the LLM in ChatHuggingFace to satisfy the 'conversational' requirement
32
  chat_model = ChatHuggingFace(llm=llm)
33
 
34
  # --- 3. Sidebar Selection ---
 
10
  st.markdown("Explore how different prompting techniques change AI reasoning.")
11
 
12
  # --- 2. Model Setup ---
 
13
  api_token = os.getenv("HUGGINGFACEHUB_API_TOKEN")
14
 
15
  if not api_token:
16
  st.error("Missing HUGGINGFACEHUB_API_TOKEN. Add it to your Space Secrets!")
17
  st.stop()
18
 
19
+ # Switching to Llama-3.1-8B-Instruct (Highly compatible)
20
+ repo_id = "meta-llama/Llama-3.1-8B-Instruct"
21
+
 
22
  llm = HuggingFaceEndpoint(
23
  repo_id=repo_id,
24
+ task="text-generation", # Base task
25
  temperature=0.7,
26
+ huggingfacehub_api_token=api_token,
27
+ timeout=300
28
  )
29
 
30
+ # This wrapper will now correctly identify Llama as a chat-capable model
31
  chat_model = ChatHuggingFace(llm=llm)
32
 
33
  # --- 3. Sidebar Selection ---