Skip to content

Commit

Permalink
Merge pull request #64 from stackhpc/feat/flux-image-gen
Browse files Browse the repository at this point in the history
Flux image gen chart improvements
  • Loading branch information
sd109 authored Nov 12, 2024
2 parents f8d17e0 + ee82539 commit 4fd698c
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 12 deletions.
2 changes: 1 addition & 1 deletion charts/flux-image-gen/templates/ui/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ data:
address: {{ printf "http://%s.%s.svc:%v" ( printf "%s-%s-api" (include "flux-image-gen.fullname" $) . ) $.Release.Namespace $.Values.api.service.port }}
{{- end }}
example_prompt: |
{{- .Values.examplePrompt | nindent 6 -}}
{{- .Values.examplePrompt | trimSuffix "\n" | nindent 6 -}}
6 changes: 3 additions & 3 deletions charts/flux-image-gen/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ api:
deploymentStrategy:
type: Recreate

# Downloading 100GB+ of model weights can take a long time so
# it's difficult to give these probes sensible default values...
# Downloading model weights can take a long time so it's
# difficult to give these probes sensible default values
# Is 30 minutes long enough...?
startupProbe:
# httpGet:
# path: /
# port: http
# Is 30 minutes long enough...?
# failureThreshold: 180
# periodSeconds: 10
livenessProbe:
Expand Down
2 changes: 1 addition & 1 deletion web-apps/chat/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
gradio<5
gradio==4.21 # v4.41 breaks custom JS query param parsing
gradio_client
openai
langchain
Expand Down
3 changes: 3 additions & 0 deletions web-apps/flux-image-gen/api_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ class ImageGenInput(BaseModel):
prompt: str
add_sampling_metadata: bool

@app.get("/")
def health_check():
return "Server is running"

@app.get("/model")
async def get_model():
Expand Down
9 changes: 5 additions & 4 deletions web-apps/flux-image-gen/gradio_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ class Model(BaseModel):

class AppSettings(BaseModel):
models: List[Model]
example_prompt: str
example_prompt: str = "Yoda riding a skateboard."
title: str = "Flux Image Generation Demo"



settings_path = pathlib.Path("/etc/gradio-app/gradio_config.yaml")
Expand Down Expand Up @@ -93,9 +95,8 @@ async def generate_image(

return image, seed, filename, None


with gr.Blocks() as demo:
gr.Markdown("# Flux Image Generation Demo")
with gr.Blocks(title=settings.title) as demo:
gr.Markdown(f"# {settings.title}")

with gr.Row():
with gr.Column():
Expand Down
2 changes: 1 addition & 1 deletion web-apps/image-analysis/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pillow
requests
gradio<5
gradio==4.21 # v4.41 breaks custom JS query param parsing
gradio_client
pydantic
structlog
Expand Down
22 changes: 20 additions & 2 deletions web-apps/kind-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,32 @@ if [[ -z $1 ]]; then
exit 1
fi

# Work around storage limits in GH runners
if [[ $CI == "true" ]]; then
DIR=/mnt/gimme-more-space
sudo mkdir -p $DIR
sudo chown -R $USER:$USER $DIR
TAR_PATH=$DIR/image.tar
else
TAR_PATH="./image.tar"
fi

REMOTE_TAG=$1
CLUSTER_NAME=${2:-kind}
echo Kind cluster name: $CLUSTER_NAME
KIND_TAG=local
for image in $(find_images .); do
full_name=ghcr.io/stackhpc/azimuth-llm-$image-ui
echo $full_name
echo $full_name:{$REMOTE_TAG,$KIND_TAG}
docker pull $full_name:$REMOTE_TAG
docker image tag $full_name:$REMOTE_TAG $full_name:$KIND_TAG
kind load docker-image -n $CLUSTER_NAME $full_name:$KIND_TAG
# NOTE(scott): The 'load docker-image' command saves the
# intermediate tar archive to /tmp which has limited space
# inside a GH runner so do each step manually here instead.
# kind load docker-image -n $CLUSTER_NAME $full_name:$KIND_TAG
# Apparently there's a separate 75G disk at /mnt so try using it.
docker image save -o $TAR_PATH $full_name:$KIND_TAG
docker image rm $full_name:{$REMOTE_TAG,$KIND_TAG}
kind load image-archive -n $CLUSTER_NAME $TAR_PATH
rm $TAR_PATH
done

0 comments on commit 4fd698c

Please sign in to comment.