Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
@@ -484,11 +484,8 @@ def filter_input_with_llama_guard(user_input, model="meta-llama/llama-guard-4-12
|
|
484 |
model=model,
|
485 |
)
|
486 |
# Return the filtered input
|
487 |
-
st.write(response);
|
488 |
-
st.write(response.choices[0].message.content.strip());
|
489 |
return response.choices[0].message.content.strip()
|
490 |
except Exception as e:
|
491 |
-
st.write(f"Error with Llama Guard: {e}");
|
492 |
print(f"Error with Llama Guard: {e}")
|
493 |
return None
|
494 |
|
@@ -700,7 +697,6 @@ def nutrition_disorder_streamlit():
|
|
700 |
|
701 |
# Filter input using Llama Guard
|
702 |
filtered_result = filter_input_with_llama_guard(user_query)
|
703 |
-
st.write(filtered_result)
|
704 |
filtered_result = filtered_result.replace("\n", " ") # Normalize the result
|
705 |
|
706 |
# Check if input is safe based on allowed statuses
|
|
|
484 |
model=model,
|
485 |
)
|
486 |
# Return the filtered input
|
|
|
|
|
487 |
return response.choices[0].message.content.strip()
|
488 |
except Exception as e:
|
|
|
489 |
print(f"Error with Llama Guard: {e}")
|
490 |
return None
|
491 |
|
|
|
697 |
|
698 |
# Filter input using Llama Guard
|
699 |
filtered_result = filter_input_with_llama_guard(user_query)
|
|
|
700 |
filtered_result = filtered_result.replace("\n", " ") # Normalize the result
|
701 |
|
702 |
# Check if input is safe based on allowed statuses
|