From be633ce72f1a78ec435e738bbc1cceebff187bff Mon Sep 17 00:00:00 2001 From: jianjiang Date: Fri, 21 Apr 2023 20:10:50 +0800 Subject: [PATCH] ok --- .app.py.swp | Bin 0 -> 12288 bytes .gitea/workflows/build.yaml | 47 ++++++++++++++++++++++++++++++++++++ Dockerfile | 11 +++++++++ app.py | 34 ++++++++++++++++++++++++++ requirements.txt | 1 + 5 files changed, 93 insertions(+) create mode 100644 .app.py.swp create mode 100644 .gitea/workflows/build.yaml create mode 100644 Dockerfile create mode 100644 app.py create mode 100644 requirements.txt diff --git a/.app.py.swp b/.app.py.swp new file mode 100644 index 0000000000000000000000000000000000000000..55bf0f91254f8d30d7e29b9610be4a416342df63 GIT binary patch literal 12288 zcmeI2&5jdC5XYNvAWHZW+;Rwwm&kUqGqwRCgk&OMSqUYPkfLx|p;p_|V|VE39=dy0 zEF5yn3q;}-cmYmGpu9vbxp3ksxa8ks8(3#oNZgRBt^a)VRMph{y5=x)O@{aG{KBv1 zLxyphv45Z3EKc!*U~1< z1~V@U?L_IkklM(}AQaiIR9P9bDyV_1>%87uk3#1}fCzjVffMY~#ZmjJZ*@uXGtK|N7x_8{EKDwo#p<>+J1RTJ0d^?hyW2F0z`la z5CI}U1c(3;AOb|-GbA7j#=iNQu~$&~|9|!U|IaDLo6*Pd3L9b6T_8j^X+JU;z zchCiB1A2Rcu@}%2=rJ^beuS<=8MF!g0DTF)InLPM&{HTt96ASm3mt`0PA^klG>8BZ zAOb{y2oM1xKm>>Y5dZ;>QK-u04;$5}-qhJ?AV+|-&I~% zSt&l|onhYoI(?=~F4}1!_!w7&sHC<+bgnJ$knZx~P>*C)8x;^{rz?3qchPZIa%nj_ zf4#Hl1Lj^A+RnJ-bLWHN&hkq7(7oShABI{T$GK|LYWJH5o9JlT%%ge~FX~FpROetz z*TlMsVcczvx(6F+yRb>oV3H`}d1gMpW6``^%Bkv=cKrTcn@bp8#l~CShF&Z{dkEiJ z*Q!^0SJknfx07LKcps5V{yxmg0Bn;z+Y+=hF!Yu8od+QtxlB#=5rw5u$SoDc{p!kc^GW zid8Dv?kKyQJ_r|UHfdsX7AfJ`{GOP|>4TX^l@+4Y#)!E?d5yapx3_L@Z*MQDulqQU zL{Xc@CDY4WS1uiDx<5Ru5%ti(3GgB;9%wzVanlDPrt%RVw?iAcGKbo&>J)X-9)^5N zm9jChms;7IAcB6Z#%UAs<&1S!_4A-&kEJC=iKV9Zm3tGl38<#p`N&&8wmezb;f;dF Z!gH}O%D=Neq;%G-^LC-%Iqj<$_8+fhme~LR literal 0 HcmV?d00001 diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml new file mode 100644 index 0000000..1966567 --- /dev/null +++ b/.gitea/workflows/build.yaml @@ -0,0 +1,47 @@ +name: Build +run-name: ${{ github.actor }} is upgrade release 🚀 +on: [push] +env: + REPOSITORY: ${{ github.repository }} + COMMIT_ID: ${{ github.sha }} +jobs: + Build-Deploy-Actions: + runs-on: ubuntu-latest + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!" + - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." + - name: Check out repository code + uses: actions/checkout@v3 + - + name: Setup Git LFS + run: | + git lfs install + git lfs fetch + git lfs checkout + - name: List files in the repository + run: | + ls ${{ github.workspace }} + - + name: Docker Image Info + id: image-info + run: | + echo "::set-output name=image_name::$(echo $REPOSITORY | tr '[:upper:]' '[:lower:]')" + echo "::set-output name=image_tag::${COMMIT_ID:0:10}" + - + name: Login to Docker Hub + uses: docker/login-action@v2 + with: + registry: artifacts.iflytek.com + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - + name: Build and push + run: | + docker version + docker buildx build -t artifacts.iflytek.com/docker-private/atp/${{ steps.image-info.outputs.image_name }}:${{ steps.image-info.outputs.image_tag }} . --file ${{ github.workspace }}/Dockerfile --load + docker push artifacts.iflytek.com/docker-private/atp/${{ steps.image-info.outputs.image_name }}:${{ steps.image-info.outputs.image_tag }} + docker rmi artifacts.iflytek.com/docker-private/atp/${{ steps.image-info.outputs.image_name }}:${{ steps.image-info.outputs.image_tag }} + - run: echo "🍏 This job's status is ${{ job.status }}." diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5b47bb2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +#FROM python:3.8.13 +FROM artifacts.iflytek.com/docker-private/atp/base_image_for_ailab:0.0.1 + +WORKDIR /app + +COPY . /app + +RUN pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple +RUN pip install -r requirements.txt + +CMD ["python", "app.py"] diff --git a/app.py b/app.py new file mode 100644 index 0000000..8b0c4fc --- /dev/null +++ b/app.py @@ -0,0 +1,34 @@ +from diffusers.models import AutoencoderKL +from diffusers import StableDiffusionPipeline +import gradio as gr +from gradio.themes.utils import sizes +theme = gr.themes.Default(radius_size=sizes.radius_none).set( + block_label_text_color = '#4D63FF', + block_title_text_color = '#4D63FF', + button_primary_text_color = '#4D63FF', + button_primary_background_fill='#FFFFFF', + button_primary_border_color='#4D63FF', + button_primary_background_fill_hover='#EDEFFF', +) + + +model = "CompVis/stable-diffusion-v1-4" +vae = AutoencoderKL.from_pretrained("stabilityai/sd-vae-ft-mse") +pipe = StableDiffusionPipeline.from_pretrained(model, vae=vae) + +def text2image(prompt): + image = pipe(prompt).images[0] + + return image + + +demo = gr.Interface(fn=text2image, + inputs='text', + outputs='image', + title = "text2image", + theme = theme, + examples = ['a photo of an astronaut riding a horse on mars']) + + +if __name__ == "__main__": + demo.queue(concurrency_count=10).launch(server_name = "0.0.0.0") diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..6033efb --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +diffusers