DJ-Goanna-Coding commited on
Commit
6730c30
·
verified ·
1 Parent(s): aaa0af6

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +15 -35
app.py CHANGED
@@ -1,39 +1,19 @@
 
 
1
 
2
- import os, json
3
- from flask import Flask, request, jsonify
4
- from huggingface_hub import HfApi
5
 
6
- app = Flask(__name__)
7
- # Securely pulling the token from the Space's settings
8
- TOKEN = os.getenv("HF_TOKEN")
9
- VAULT_ID = "DJ-Goanna-Coding/TIA-storage"
10
- api = HfApi(token=TOKEN)
11
 
12
- @app.route('/ignite_harvest', methods=['POST'])
13
- @app.route('/ingest', methods=['POST'])
14
- def catch_payload():
15
- if not TOKEN:
16
- return jsonify({"status": "ERROR", "message": "HF_TOKEN secret is missing in Space settings"}), 500
17
-
18
- try:
19
- payload = request.json
20
- filename = payload.get("fileName", "unknown_shard.9293")
21
- content = payload.get("content", "")
22
-
23
- # Save the incoming lightweight text directly to the HF Dataset
24
- api.upload_file(
25
- path_or_fileobj=content.encode('utf-8'),
26
- path_in_repo=f"ingested_core/{filename}",
27
- repo_id=VAULT_ID,
28
- repo_type="dataset"
29
- )
30
- return jsonify({"status": "CAUGHT_AND_STORED", "file": filename}), 200
31
- except Exception as e:
32
- return jsonify({"status": "ERROR", "message": str(e)}), 500
33
 
34
- @app.route('/', methods=['GET'])
35
- def health_check():
36
- return jsonify({"status": "SOVEREIGN_NODE_ONLINE", "vault": "TIA-storage"})
37
-
38
- if __name__ == "__main__":
39
- app.run(host="0.0.0.0", port=7860)
 
1
+ import streamlit as st
2
+ import os
3
 
4
+ # --- PREVENT REGISTRY COLLISION ---
5
+ # Every node gets a unique internal pathname frequency
6
+ page_id = "TIA_fbcc"
7
 
8
+ def run_main():
9
+ st.title("🧠 CITADEL NODE: TIA")
10
+ st.subheader("777.1122 Alignment: ACTIVE")
11
+ st.sidebar.success("NODE ONLINE")
12
+ st.write("System status: Operator-Grade. Collision vaporized.")
13
 
14
+ # Explicit Navigation setup
15
+ main_page = st.Page(run_main, title="Node HUD", icon="🏛️", url_path="main_hub_" + unique_suffix)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
+ # Apply Navigation
18
+ pg = st.navigation([main_page])
19
+ pg.run()