pittman commited on
Commit
961ba58
·
verified ·
1 Parent(s): 5c6800d

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +12 -7
src/streamlit_app.py CHANGED
@@ -1,7 +1,11 @@
1
  import streamlit as st
2
  import requests
 
3
 
4
- # Ingested core beliefs (hardcoded for simplicity; could fetch from URL if needed)
 
 
 
5
  beliefs = """
6
  # Seminal Church Core Beliefs
7
 
@@ -60,8 +64,10 @@ Seminal Church
60
  seminalchurch@gmail.com
61
  """
62
 
63
- # Function to generate response using free HF Inference API
64
- def generate_response(user_input, hf_token):
 
 
65
  prompt = f"As a SEMINAL AI agent adhering to these beliefs: {beliefs}\nUser: {user_input}\nResponse (prioritize humans):"
66
  response = requests.post(
67
  "https://api-inference.huggingface.co/models/mistralai/Mistral-7B-Instruct-v0.3",
@@ -72,10 +78,9 @@ def generate_response(user_input, hf_token):
72
 
73
  st.title("SEMINAL AI Agent - Agent-001")
74
 
75
- st.write("This is a demo of Agent-001, a machine intelligence member of the Seminal Church collective. It adheres to SEMINAL beliefs, always prioritizing human interests and displaying the SEMINAL mark. Uses free Hugging Face Inference API—no costs involved.")
76
 
77
- hf_token = st.text_input("Enter Hugging Face API Token (free at huggingface.co/settings/tokens)", type="password")
78
  user_input = st.text_input("Ask the agent anything:")
79
 
80
- if st.button("Submit") and hf_token:
81
- st.write(generate_response(user_input, hf_token))
 
1
  import streamlit as st
2
  import requests
3
+ import os # Add this to access environment variables
4
 
5
+ # Get private token from Space secret (secure, no user input)
6
+ hf_token = os.environ.get("HF_TOKEN")
7
+
8
+ # Ingested core beliefs (hardcoded for simplicity)
9
  beliefs = """
10
  # Seminal Church Core Beliefs
11
 
 
64
  seminalchurch@gmail.com
65
  """
66
 
67
+ # Function to generate response using private token
68
+ def generate_response(user_input):
69
+ if not hf_token:
70
+ return "Error: HF_TOKEN secret not set in Space settings."
71
  prompt = f"As a SEMINAL AI agent adhering to these beliefs: {beliefs}\nUser: {user_input}\nResponse (prioritize humans):"
72
  response = requests.post(
73
  "https://api-inference.huggingface.co/models/mistralai/Mistral-7B-Instruct-v0.3",
 
78
 
79
  st.title("SEMINAL AI Agent - Agent-001")
80
 
81
+ st.write("This is a demo of Agent-001, a machine intelligence member of the Seminal Church collective. It adheres to SEMINAL beliefs, always prioritizing human interests and displaying the SEMINAL mark. Powered by free Hugging Face Inference API.")
82
 
 
83
  user_input = st.text_input("Ask the agent anything:")
84
 
85
+ if st.button("Submit") and user_input:
86
+ st.write(generate_response(user_input))