0.3, fix perf issues by having static canned on first launch
Build and Publish Docker Image / Build and Push Docker Image (push) Successful in 3m16s
Details
Build and Publish Docker Image / Build and Push Docker Image (push) Successful in 3m16s
Details
This commit is contained in:
parent
a99be0bd93
commit
e983a425c6
13
app.py
13
app.py
|
|
@ -1,4 +1,5 @@
|
|||
import os
|
||||
import random
|
||||
import configparser
|
||||
import requests
|
||||
from flask import Flask, render_template_string, jsonify, send_from_directory
|
||||
|
|
@ -10,6 +11,16 @@ OLLAMA_MODEL = os.environ.get("OLLAMA_MODEL", "gemma4:e4b")
|
|||
PROMPT = os.environ.get("JOKE_PROMPT", "tell me a dad joke about programming")
|
||||
PORT = int(os.environ.get("PORT", "80"))
|
||||
|
||||
PRESET_JOKES = [
|
||||
"What do you call parenting with a software engineer? Pair programming (or O-pair programming).",
|
||||
"My kids were rolling on the floor and screaming. My wife asked what was happening, and I told her it was a version conflict.",
|
||||
"When I wrote this code, only God and I knew how it worked. Now, only God knows.",
|
||||
"A programmer is sent to the store by his wife: “Get a gallon of milk, and if they have eggs, get a dozen.” The programmer returns home with 13 gallons of milk and says, “They had eggs”.",
|
||||
"Where do coder dads store all their projects? In a dad-abase.",
|
||||
"Why don't programmers like going outside into nature? Too many bugs.",
|
||||
"Why did the programmer die taking a shower? The shampoo bottle instructions said: Lather. Rinse. Repeat."
|
||||
]
|
||||
|
||||
def get_app_version():
|
||||
config = configparser.ConfigParser()
|
||||
version_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), "version.ini")
|
||||
|
|
@ -696,7 +707,7 @@ def request_joke():
|
|||
|
||||
@app.route("/")
|
||||
def index():
|
||||
joke = request_joke()
|
||||
joke = random.choice(PRESET_JOKES)
|
||||
version = get_app_version()
|
||||
return render_template_string(
|
||||
HTML_TEMPLATE,
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
[metadata]
|
||||
version = 0.2
|
||||
version = 0.3
|
||||
|
|
|
|||
Loading…
Reference in New Issue