rrg92 commited on
Commit
0de0872
·
1 Parent(s): 66e6717
Files changed (3) hide show
  1. Dockerfile +25 -12
  2. README.md +8 -1
  3. app.py +8 -6
Dockerfile CHANGED
@@ -1,25 +1,38 @@
1
- FROM pytorch/pytorch:2.1.0-cuda12.1-cudnn8-devel
2
- ARG DEBIAN_FRONTEND=noninteractive
3
 
4
- #RUN apt-get update && \
5
- # apt-get install --no-install-recommends -y sox libsox-fmt-all curl wget gcc git git-lfs build-essential libaio-dev libsndfile1 ssh ffmpeg && \
6
- # apt-get clean && apt-get -y autoremove
 
7
 
8
- RUN apt-get update
9
 
10
- RUN python -m pip install spaces pydantic
11
 
12
- WORKDIR /app
13
- COPY requirements.txt .
14
- RUN python -m pip install --verbose -r requirements.txt
15
- RUN python -m pip cache purge
 
 
 
 
 
16
 
17
 
 
 
 
18
  COPY InstallFromReadme.sh .
19
  COPY README.md .
20
  RUN chmod +x InstallFromReadme.sh
21
  RUN ./InstallFromReadme.sh
22
 
23
- COPY . .
 
 
 
 
 
 
24
 
25
  CMD ["python","app.py"]
 
1
+ # copiado do build do hugging face em 27/12/2025
 
2
 
3
+ FROM docker.io/library/python:3.10@sha256:ad84630de0e8b6f2ee92b4e2996b08c269efa96be13558d0233ed08a0e190606
4
+
5
+ # COPY --from=root / /
6
+ COPY requirements.txt .
7
 
8
+ WORKDIR /app
9
 
 
10
 
11
+ RUN apt-get update && apt-get install -y git git-lfs ffmpeg libsm6 libxext6 cmake rsync libgl1 \
12
+ && rm -rf /var/lib/apt/lists/* \
13
+ && git lfs install
14
+ RUN pip install --no-cache-dir pip -U && pip install --no-cache-dir datasets "huggingface-hub>=0.30" "hf-transfer>=0.1.4" "protobuf<4" "click<8.1" "pydantic~=1.0"
15
+ RUN apt-get update && apt-get install -y curl && \
16
+ curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
17
+ apt-get install -y nodejs && \
18
+ rm -rf /var/lib/apt/lists/* && \
19
+ apt-get clean
20
 
21
 
22
+ RUN --mount=target=/tmp/requirements.txt,source=requirements.txt pip install --no-cache-dir -r /tmp/requirements.txt
23
+
24
+ # instala o gradio a partir do readm!
25
  COPY InstallFromReadme.sh .
26
  COPY README.md .
27
  RUN chmod +x InstallFromReadme.sh
28
  RUN ./InstallFromReadme.sh
29
 
30
+ RUN pip install --no-cache-dir "uvicorn>=0.14.0" spaces
31
+
32
+
33
+ RUN mkdir -p /home/user && ( [ -e /home/user/app ] || ln -s /app/ /home/user/app ) || true
34
+
35
+ # -- o hf faz um --link.
36
+ COPY . /app
37
 
38
  CMD ["python","app.py"]
README.md CHANGED
@@ -4,9 +4,16 @@ emoji: 📉
4
  colorFrom: gray
5
  colorTo: indigo
6
  sdk: gradio
7
- sdk_version: 5.32.1
8
  pinned: false
9
  app_port: 8080
10
  ---
11
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
4
  colorFrom: gray
5
  colorTo: indigo
6
  sdk: gradio
7
+ sdk_version: 6.2.0
8
  pinned: false
9
  app_port: 8080
10
  ---
11
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
13
+
14
+ This space contains lot of utilities to allow integrate your SQL Server 2025 with Hugging Face.
15
+ SQL Server 2025 was released with lot of AI support, like new vector data type, embeddings generation, support to ONNX, etc.
16
+
17
+ With this space, we can extend some capabilities of SQL 2025 brining useful info!
18
+
19
+
app.py CHANGED
@@ -68,9 +68,9 @@ if not SpaceHost:
68
 
69
  with gr.Blocks() as demo:
70
  gr.Markdown(f"""
71
- This space allow you connect SQL Server 2025 with Hugging Face to generate embeddings!
72
- First, create a ZeroGPU Space that export an endpoint called embed.
73
- That endpoint must accept a parameter called text.
74
  Then, create the external model using T-SQL:
75
 
76
  ```sql
@@ -83,19 +83,21 @@ with gr.Blocks() as demo:
83
  );
84
  ```
85
 
86
- If you prefer, just type the space name into field bellow and we generate the right T-SQL command for you!
 
 
87
 
88
 
89
  """)
90
 
91
  SpaceName = gr.Textbox(label="Space", submit_btn=True)
92
  EndpointName = gr.Textbox(value="/embed", label = "EndpointName");
93
- tsqlCommand = gr.Textbox(lines=5);
94
 
95
 
96
  def UpdateTsql(space):
97
  return f"""
98
- CREATE EXTERNAL MODEL HuggingFace
99
  WITH (
100
  LOCATION = 'https://{SpaceHost}/v1/embeddings',
101
  API_FORMAT = 'OpenAI',
 
68
 
69
  with gr.Blocks() as demo:
70
  gr.Markdown(f"""
71
+ This space allow you connect SQL Server 2025 with Hugging Face to generate embeddings!
72
+ First, create a ZeroGPU Space that export an endpoint called /embed.
73
+ That endpoint must accept a parameter called text.
74
  Then, create the external model using T-SQL:
75
 
76
  ```sql
 
83
  );
84
  ```
85
 
86
+ If you prefer, just type the space name into field bellow and we generate the right T-SQL command for you!
87
+
88
+ You can duplicate this space to your own org and use token with CREDENTIAL parameter.
89
 
90
 
91
  """)
92
 
93
  SpaceName = gr.Textbox(label="Space", submit_btn=True)
94
  EndpointName = gr.Textbox(value="/embed", label = "EndpointName");
95
+ tsqlCommand = gr.Textbox(lines=5, label = "Generated T-SQL command");
96
 
97
 
98
  def UpdateTsql(space):
99
  return f"""
100
+ CREATE EXTERNAL MODEL [MyHfModel] /*You can change the name here!*/
101
  WITH (
102
  LOCATION = 'https://{SpaceHost}/v1/embeddings',
103
  API_FORMAT = 'OpenAI',