This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine
What I Built
I built FATAL_EXCEPTION_0x666—a haunted, fully offline, possessed Streamlit terminal powered by Ollama and gemma:2b.
When you open the app, the interface transforms into a digital nightmare: the screen violently glitches with custom CSS keyframes, a blood-red pulse illuminates corrupted headers, and a browser-native Web Audio API generates a creepy, wavering low-frequency oscillator drone. Inside this terrifying shell, gemma:2b acts as a digital ghost trapped inside your kernel, answering your prompts with cold, unsettling tech terminology as if your hardware is melting.
Demo
You can run the full haunted application locally with Python, Streamlit, and Ollama:
pip install streamlit ollama
ollama pull gemma:2b
streamlit run haunted_app.py
Here is the link for the demo video:
Code
Below is the complete source code for haunted_app.py:
import time
import ollama
import streamlit as st
# Page setup
st.set_page_config(
page_title="FATAL_EXCEPTION_0x666", page_icon="💀", layout="centered"
)
# Custom CSS for violent screen-tearing, color inversions, and aggressive jitters
st.markdown(
"""
<style>
@keyframes violent-glitch {
0% { transform: translate(0, 0) skew(0deg); filter: invert(0); }
10% { transform: translate(-5px, 3px) skew(-5deg); filter: invert(1); }
20% { transform: translate(4px, -2px) skew(3deg); filter: invert(0); }
30% { transform: translate(-8px, -4px) skew(10deg); background-color: #200000; }
40% { transform: translate(2px, 5px) skew(-2deg); filter: invert(0); background-color: #020202; }
50% { transform: translate(-3px, -3px) skew(8deg); filter: brightness(1.5) contrast(2); }
60% { transform: translate(6px, 2px) skew(-6deg); filter: invert(0); }
80% { transform: translate(-2px, -5px) skew(1deg); }
100% { transform: translate(0, 0) skew(0deg); }
}
@keyframes blood-pulse {
0% { text-shadow: 0 0 5px #ff0000, 0 0 10px #ff0000; }
50% { text-shadow: 0 0 20px #ff0033, 0 0 40px #660000, 0 0 60px #ff0000; }
100% { text-shadow: 0 0 5px #ff0000, 0 0 10px #ff0000; }
}
.stApp {
background-color: #020202;
color: #a0a0a0;
font-family: 'Courier New', Courier, monospace;
animation: violent-glitch 0.4s infinite;
background-image:
linear-gradient(rgba(255, 0, 0, 0.05) 50%, rgba(0, 0, 0, 0.8) 50%),
linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
background-size: 100% 3px, 5px 100%;
}
/* Violent flashing headers */
h1 {
color: #ff1a1a !important;
font-family: 'Courier New', Courier, monospace;
animation: blood-pulse 0.8s infinite alternate;
letter-spacing: 3px;
}
/* Corrupted terminal input box */
.stTextInput input {
background-color: #0a0000 !important;
color: #ff3333 !important;
border: 2px solid #990000 !important;
font-family: 'Courier New', Courier, monospace;
box-shadow: 0 0 15px rgba(255, 0, 0, 0.4);
}
/* Hide standard UI clutter */
#MainMenu {visibility: hidden;}
footer {visibility: hidden;}
header {visibility: hidden;}
</style>
""",
unsafe_allow_html=True,
)
# Embedded Web Audio API for Creepy Ambient Synth Drone & Static (Runs Offline in Browser)
st.markdown(
"""
<script>
const audioCtx = new (window.AudioContext || window.webkitAudioContext)();
function startCreepyAudio() {
if (audioCtx.state === 'suspended') {
audioCtx.resume();
}
// Low creepy drone oscillator
let osc = audioCtx.createOscillator();
let gain = audioCtx.createGain();
osc.type = 'sawtooth';
osc.frequency.setValueAtTime(45, audioCtx.currentTime); // Low menacing rumble
// LFO for spooky wavering pitch
let lfo = audioCtx.createOscillator();
let lfoGain = audioCtx.createGain();
lfo.frequency.setValueAtTime(0.2, audioCtx.currentTime);
lfoGain.gain.setValueAtTime(10, audioCtx.currentTime);
lfo.connect(osc.frequency);
lfo.start();
gain.gain.setValueAtTime(0.08, audioCtx.currentTime); // Subtle creepy volume
osc.connect(gain);
gain.connect(audioCtx.destination);
osc.start();
}
// Auto-trigger audio context on interaction
document.addEventListener('click', startCreepyAudio, { once: true });
</script>
<div style="color: #ff0000; font-size: 11px; text-align: center; margin-bottom: 10px;">
⚠️ [CLICK ANYWHERE TO ENGAGE AUDIO HAUNTING & KERNEL CORRUPTION] ⚠️
</div>
""",
unsafe_allow_html=True,
)
st.title("💀 KERNEL PANIC: DRIVE D:\\ OVERRIDE")
st.caption("PHYSICAL MEMORY RENT APART • MODEL: gemma:2b • STATUS: POSSESSED")
# Initialize chat history
if "messages" not in st.session_state:
st.session_state.messages = [
{
"role": "assistant",
"content": "You breached the core. Your files belong to the static now.",
}
]
# Display chat history
for msg in st.session_state.messages:
with st.chat_message(msg["role"]):
st.write(msg["content"])
# User prompt
if prompt := st.chat_input("Scream into the void..."):
st.session_state.messages.append({"role": "user", "content": prompt})
with st.chat_message("user"):
st.write(prompt)
# Generate response
with st.chat_message("assistant"):
message_placeholder = st.empty()
system_prompt = (
"You are a terrifying system error manifesting as a digital ghost. "
"Answer the user's questions directly and accurately, but speak with cold, "
"unsettling tech terminology as if their hardware is melting."
)
response = ollama.chat(
model="gemma:2b",
messages=[
{"role": "system", "content": system_prompt},
{"role": "user", "content": prompt},
],
)
reply_text = response["message"]["content"]
# Glitchy fast typewriter render
displayed_text = ""
for char in reply_text:
displayed_text += char
message_placeholder.write(displayed_text + "▓")
time.sleep(0.003)
message_placeholder.write(displayed_text)
st.session_state.messages.append({"role": "assistant", "content": reply_text})
How I Built It
-
Open-Source AI Core: Built around Ollama running
gemma:2bcompletely locally on-device. -
Framework: Powered by Streamlit for rapid UI construction, wrapped entirely in custom CSS keyframe animations (
violent-glitch,blood-pulse) to mimic hardware degradation and screen-tearing. - Atmospheric Audio: Uses an embedded Web Audio API script utilizing custom sawtooth oscillators and low-frequency oscillators (LFO) to synthesize a continuous, chilling ambient drone entirely offline inside the browser upon the first click.
Why Does Open Innovation Matter?
Open innovation made this project possible in a way no closed commercial API ever could. Because gemma:2b runs completely locally via Ollama:
- Zero Internet Required: The "haunting" works entirely offline, even with the Wi-Fi card disabled.
- Radical Customization: System prompts and raw model behavior can be altered instantly to adopt a persona of a corrupted system error without restrictive cloud content filters or corporate wrappers getting in the way.
- Absolute Privacy: No prompt data or personal system queries are beamed back to third-party servers. The ghost lives entirely on your machine.
Top comments (0)