Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -34,7 +34,7 @@ if "follow_up" not in st.session_state:
|
|
| 34 |
st.session_state.follow_up = ""
|
| 35 |
|
| 36 |
# ✅ Initialize Hugging Face Model (Explicitly Set to CPU/GPU)
|
| 37 |
-
def get_llm_hf_inference(model_id="meta-llama/Llama-2-7b-chat-hf", max_new_tokens=800, temperature=0.
|
| 38 |
#mistralai/Mistral-7B-Instruct-v0.3
|
| 39 |
return HuggingFaceEndpoint(
|
| 40 |
repo_id=model_id,
|
|
@@ -91,7 +91,7 @@ def generate_follow_up(user_text):
|
|
| 91 |
"Ensure it's concise and structured exactly as requested without extra commentary."
|
| 92 |
)
|
| 93 |
|
| 94 |
-
hf = get_llm_hf_inference(max_new_tokens=30, temperature=0.
|
| 95 |
output = hf.invoke(input=prompt_text).strip()
|
| 96 |
|
| 97 |
# ✅ Extract the relevant part using regex to remove unwanted symbols or truncations
|
|
@@ -120,7 +120,7 @@ def get_response(system_message, chat_history, user_text, max_new_tokens=800):
|
|
| 120 |
return response, follow_up, chat_history, nasa_url
|
| 121 |
|
| 122 |
# ✅ Invoke Hugging Face Model
|
| 123 |
-
hf = get_llm_hf_inference(max_new_tokens=max_new_tokens, temperature=0.
|
| 124 |
|
| 125 |
filtered_history = "\n".join(f"{msg['role']}: {msg['content']}" for msg in chat_history)
|
| 126 |
|
|
|
|
| 34 |
st.session_state.follow_up = ""
|
| 35 |
|
| 36 |
# ✅ Initialize Hugging Face Model (Explicitly Set to CPU/GPU)
|
| 37 |
+
def get_llm_hf_inference(model_id="meta-llama/Llama-2-7b-chat-hf", max_new_tokens=800, temperature=0.7):
|
| 38 |
#mistralai/Mistral-7B-Instruct-v0.3
|
| 39 |
return HuggingFaceEndpoint(
|
| 40 |
repo_id=model_id,
|
|
|
|
| 91 |
"Ensure it's concise and structured exactly as requested without extra commentary."
|
| 92 |
)
|
| 93 |
|
| 94 |
+
hf = get_llm_hf_inference(max_new_tokens=30, temperature=0.3) # 🔥 Lower temp for consistency
|
| 95 |
output = hf.invoke(input=prompt_text).strip()
|
| 96 |
|
| 97 |
# ✅ Extract the relevant part using regex to remove unwanted symbols or truncations
|
|
|
|
| 120 |
return response, follow_up, chat_history, nasa_url
|
| 121 |
|
| 122 |
# ✅ Invoke Hugging Face Model
|
| 123 |
+
hf = get_llm_hf_inference(max_new_tokens=max_new_tokens, temperature=0.7)
|
| 124 |
|
| 125 |
filtered_history = "\n".join(f"{msg['role']}: {msg['content']}" for msg in chat_history)
|
| 126 |
|