CalebCampbell commited on
Commit
cdee6a3
·
verified ·
1 Parent(s): ca4ac33

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -13
app.py CHANGED
@@ -1,12 +1,12 @@
1
  #!/usr/bin/env python3
2
  """
3
- Hugging Face Spaces - OpenAI Compatible Embedding API (API-Only) - Updated 2025-09-15
4
  ================================================================
5
 
6
  Deploy your EdgeHomes ModernBERT model as an OpenAI-compatible API on HF Spaces.
7
  Pure API endpoint - no UI components.
8
 
9
- API URL: https://huggingface.co/spaces/CalebCampbell/edgehomes-embedding-api/api/v1/embeddings
10
  """
11
 
12
  import gradio as gr
@@ -19,7 +19,7 @@ import time
19
  import os
20
 
21
  # DEBUGGING: Print to confirm this file is being used
22
- print("🚨 USING UPDATED APP.PY FILE - NO SENTENCE TRANSFORMERS! 🚨")
23
 
24
  from transformers import AutoTokenizer, AutoModel
25
  import torch
@@ -180,16 +180,18 @@ with gr.Blocks(title="EdgeHomes Embedding API") as demo:
180
  POST /api/v1/embeddings
181
  ```
182
 
183
- ## Usage in Next.js
184
  ```typescript
185
- const client = new OpenAI({
186
- baseURL: 'https://huggingface.co/spaces/CalebCampbell/edgehomes-embedding-api/api/v1',
187
- apiKey: 'your-secret-bearer-token'
188
- });
189
-
190
- const embeddings = await client.embeddings.create({
191
- input: "Your text here",
192
- model: "edgehomes-modernbert-v1"
 
 
193
  });
194
  ```
195
 
@@ -202,4 +204,4 @@ app = gr.mount_gradio_app(app, demo, path="/")
202
 
203
  if __name__ == "__main__":
204
  import uvicorn
205
- uvicorn.run(app, host="0.0.0.0", port=7860)
 
1
  #!/usr/bin/env python3
2
  """
3
+ Hugging Face Spaces - OpenAI Compatible Embedding API (API-Only)
4
  ================================================================
5
 
6
  Deploy your EdgeHomes ModernBERT model as an OpenAI-compatible API on HF Spaces.
7
  Pure API endpoint - no UI components.
8
 
9
+ API URL: https://builtbyhq-edgehomes-embedding.hf.space/api/v1/embeddings
10
  """
11
 
12
  import gradio as gr
 
19
  import os
20
 
21
  # DEBUGGING: Print to confirm this file is being used
22
+ print("🚨 STARTING EDGEHOMES EMBEDDING API 🚨")
23
 
24
  from transformers import AutoTokenizer, AutoModel
25
  import torch
 
180
  POST /api/v1/embeddings
181
  ```
182
 
183
+ ## Usage Example
184
  ```typescript
185
+ const response = await fetch('https://builtbyhq-edgehomes-embedding.hf.space/api/v1/embeddings', {
186
+ method: 'POST',
187
+ headers: {
188
+ 'Content-Type': 'application/json',
189
+ 'Authorization': 'Bearer your-secret-token'
190
+ },
191
+ body: JSON.stringify({
192
+ input: "Your text here",
193
+ model: "edgehomes-modernbert-v1"
194
+ })
195
  });
196
  ```
197
 
 
204
 
205
  if __name__ == "__main__":
206
  import uvicorn
207
+ uvicorn.run(app, host="0.0.0.0", port=7860)