AEUPH commited on
Commit
a73dca2
·
verified ·
1 Parent(s): a1ed9c3

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -12
Dockerfile CHANGED
@@ -5,7 +5,6 @@ FROM python:3.10-slim
5
  WORKDIR /app
6
 
7
  # 1. Install System Dependencies
8
- # Minimal runtime libs only. No compilers needed.
9
  RUN apt-get update && apt-get install -y \
10
  curl \
11
  git \
@@ -19,8 +18,6 @@ RUN pip install --upgrade pip
19
  RUN curl -L -o /app/VT323.ttf https://github.com/google/fonts/raw/main/ofl/vt323/VT323-Regular.ttf
20
 
21
  # 4. Install Python Dependencies
22
- # - transformers & accelerate: For running Qwen via Hugging Face
23
- # - diffusers: For the Neural Desktop (GUI)
24
  RUN pip install --no-cache-dir \
25
  torch \
26
  torchvision \
@@ -51,7 +48,6 @@ import numpy as np
51
  from flask import Flask, render_template_string
52
  from flask_sock import Sock
53
  from PIL import Image, ImageDraw
54
- # Import Hugging Face Transformers
55
  from transformers import AutoModelForCausalLM, AutoTokenizer
56
  from diffusers import StableDiffusionPipeline, AutoencoderTiny, LCMScheduler
57
 
@@ -149,7 +145,10 @@ class NeuralSystem:
149
  # A. LOAD DIFFUSION (The Display)
150
  print("[*] Loading Neural GPU (Diffusion)...")
151
  self.pipe = StableDiffusionPipeline.from_pretrained(
152
- "runwayml/stable-diffusion-v1-5", torch_dtype=self.dt
 
 
 
153
  ).to(self.device)
154
  self.pipe.vae = AutoencoderTiny.from_pretrained("madebyollin/taesd", torch_dtype=self.dt).to(self.device)
155
 
@@ -159,7 +158,7 @@ class NeuralSystem:
159
  self.tokenizer = AutoTokenizer.from_pretrained(self.model_id)
160
  self.llm = AutoModelForCausalLM.from_pretrained(
161
  self.model_id,
162
- torch_dtype=self.dt,
163
  low_cpu_mem_usage=True
164
  ).to(self.device)
165
  print("[*] Qwen Online.")
@@ -184,7 +183,6 @@ class NeuralSystem:
184
  def render_window(self, app_name, context):
185
  """ Generates a window image """
186
  prompt = f"pixel art windows xp window of {app_name}, {context}, sharp focus"
187
- # Simple rendering logic for brevity
188
  with torch.no_grad():
189
  img = self.pipe(prompt, num_inference_steps=1, guidance_scale=1.0).images[0]
190
  return img
@@ -205,7 +203,6 @@ def kernel(ws):
205
  if sys_engine is None:
206
  sys_engine = NeuralSystem()
207
 
208
- # Send initial boot screen
209
  ws.send(json.dumps({"type": "log", "data": "Qwen Kernel Loaded."}))
210
 
211
  # Generate initial desktop
@@ -225,14 +222,11 @@ def kernel(ws):
225
  msg = json.loads(data)
226
 
227
  if msg['type'] == 'click':
228
- # Example: Ask Qwen what happened
229
- response = sys_engine.think(f"The user clicked at coordinate {msg['x']},{msg['y']}. What app should open?")
230
  ws.send(json.dumps({"type": "log", "data": f"Qwen: {response}"}))
231
 
232
  @app.route('/')
233
  def index():
234
- # FIXED: Return raw HTML string instead of rendering template
235
- # This prevents Jinja2 from crashing on React's {{ }} syntax.
236
  return HTML_TEMPLATE
237
 
238
  if __name__ == '__main__':
 
5
  WORKDIR /app
6
 
7
  # 1. Install System Dependencies
 
8
  RUN apt-get update && apt-get install -y \
9
  curl \
10
  git \
 
18
  RUN curl -L -o /app/VT323.ttf https://github.com/google/fonts/raw/main/ofl/vt323/VT323-Regular.ttf
19
 
20
  # 4. Install Python Dependencies
 
 
21
  RUN pip install --no-cache-dir \
22
  torch \
23
  torchvision \
 
48
  from flask import Flask, render_template_string
49
  from flask_sock import Sock
50
  from PIL import Image, ImageDraw
 
51
  from transformers import AutoModelForCausalLM, AutoTokenizer
52
  from diffusers import StableDiffusionPipeline, AutoencoderTiny, LCMScheduler
53
 
 
145
  # A. LOAD DIFFUSION (The Display)
146
  print("[*] Loading Neural GPU (Diffusion)...")
147
  self.pipe = StableDiffusionPipeline.from_pretrained(
148
+ "runwayml/stable-diffusion-v1-5",
149
+ torch_dtype=self.dt,
150
+ safety_checker=None, # [FIX] Disable NSFW filter to prevent black images
151
+ requires_safety_checker=False
152
  ).to(self.device)
153
  self.pipe.vae = AutoencoderTiny.from_pretrained("madebyollin/taesd", torch_dtype=self.dt).to(self.device)
154
 
 
158
  self.tokenizer = AutoTokenizer.from_pretrained(self.model_id)
159
  self.llm = AutoModelForCausalLM.from_pretrained(
160
  self.model_id,
161
+ dtype=self.dt, # [FIX] Use 'dtype' instead of deprecated 'torch_dtype'
162
  low_cpu_mem_usage=True
163
  ).to(self.device)
164
  print("[*] Qwen Online.")
 
183
  def render_window(self, app_name, context):
184
  """ Generates a window image """
185
  prompt = f"pixel art windows xp window of {app_name}, {context}, sharp focus"
 
186
  with torch.no_grad():
187
  img = self.pipe(prompt, num_inference_steps=1, guidance_scale=1.0).images[0]
188
  return img
 
203
  if sys_engine is None:
204
  sys_engine = NeuralSystem()
205
 
 
206
  ws.send(json.dumps({"type": "log", "data": "Qwen Kernel Loaded."}))
207
 
208
  # Generate initial desktop
 
222
  msg = json.loads(data)
223
 
224
  if msg['type'] == 'click':
225
+ response = sys_engine.think(f"The user clicked at coordinate {msg['x']},{msg['y']}. What happens next?")
 
226
  ws.send(json.dumps({"type": "log", "data": f"Qwen: {response}"}))
227
 
228
  @app.route('/')
229
  def index():
 
 
230
  return HTML_TEMPLATE
231
 
232
  if __name__ == '__main__':