Update app.py
Browse files
app.py
CHANGED
|
@@ -1,30 +1,16 @@
|
|
| 1 |
"""
|
| 2 |
-
app.py — Tiny Civilization: The Tinywick Hollow Gazette
|
| 3 |
-
|
| 4 |
-
Build Small Hackathon 2026 — Thousand Token Wood track.
|
| 5 |
-
Model: Qwen/Qwen2.5-1.5B-Instruct (≤4B → Tiny Titan badge!)
|
| 6 |
"""
|
| 7 |
|
| 8 |
from __future__ import annotations
|
| 9 |
import json, os, random, textwrap, traceback, re
|
| 10 |
from datetime import datetime
|
| 11 |
-
from pathlib import Path
|
| 12 |
import gradio as gr
|
| 13 |
from PIL import Image, ImageDraw, ImageFont
|
| 14 |
-
import database
|
| 15 |
-
|
| 16 |
-
try:
|
| 17 |
-
import spaces
|
| 18 |
-
_ZERO_GPU = True
|
| 19 |
-
except ImportError:
|
| 20 |
-
class _Stub:
|
| 21 |
-
@staticmethod
|
| 22 |
-
def GPU(fn=None, *, duration=120):
|
| 23 |
-
return fn if callable(fn) else (lambda f: f)
|
| 24 |
-
spaces = _Stub(); _ZERO_GPU = False # type: ignore
|
| 25 |
-
|
| 26 |
import torch
|
| 27 |
-
from transformers import
|
|
|
|
| 28 |
|
| 29 |
# ═══════════════════════════════════════════════════════════════════
|
| 30 |
# 1 ▸ CONSTANTS
|
|
|
|
| 1 |
"""
|
| 2 |
+
app.py — Tiny Civilization: The Tinywick Hollow Gazette
|
| 3 |
+
Local Qwen2.5-1.5B model. No APIs. Persistent SQLite.
|
|
|
|
|
|
|
| 4 |
"""
|
| 5 |
|
| 6 |
from __future__ import annotations
|
| 7 |
import json, os, random, textwrap, traceback, re
|
| 8 |
from datetime import datetime
|
|
|
|
| 9 |
import gradio as gr
|
| 10 |
from PIL import Image, ImageDraw, ImageFont
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
import torch
|
| 12 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 13 |
+
import database
|
| 14 |
|
| 15 |
# ═══════════════════════════════════════════════════════════════════
|
| 16 |
# 1 ▸ CONSTANTS
|