Spaces:
Sleeping
Sleeping
Aaron Ploetz
commited on
Commit
Β·
6770e3b
1
Parent(s):
83ac2da
working through Gradio errors
Browse files
app.py
CHANGED
|
@@ -77,10 +77,10 @@ async def generate_embedding(data: Dict[str, Any]):
|
|
| 77 |
}
|
| 78 |
)
|
| 79 |
|
| 80 |
-
except Exception as
|
| 81 |
return JSONResponse(
|
| 82 |
status_code=500,
|
| 83 |
-
content={"error": str(
|
| 84 |
)
|
| 85 |
|
| 86 |
with gradio.Blocks(title="Multi-Model Text Embeddings", css="""
|
|
@@ -94,8 +94,7 @@ with gradio.Blocks(title="Multi-Model Text Embeddings", css="""
|
|
| 94 |
}
|
| 95 |
""") as gradio_app:
|
| 96 |
gradio.Markdown("# Multi-Model Text Embeddings")
|
| 97 |
-
gradio.Markdown("Generate embeddings for your text using
|
| 98 |
-
gradio.Markdown(f"**Device**: {DEVICE.upper()} {'π' if DEVICE == 'cuda' else 'π»'}")
|
| 99 |
|
| 100 |
# Model selector dropdown (allows custom input)
|
| 101 |
model_dropdown = gradio.Dropdown(
|
|
@@ -192,20 +191,6 @@ with gradio.Blocks(title="Multi-Model Text Embeddings", css="""
|
|
| 192 |
```
|
| 193 |
|
| 194 |
### Available Models
|
| 195 |
-
- `nomic-ai/nomic-embed-text-v1.5` (default) - High-performing open embedding model with large token context
|
| 196 |
-
- `nomic-ai/nomic-embed-text-v1` - Previous version of Nomic embedding model
|
| 197 |
-
- `mixedbread-ai/mxbai-embed-large-v1` - State-of-the-art large embedding model from mixedbread.ai
|
| 198 |
-
- `BAAI/bge-m3` - Multi-functional, multi-lingual, multi-granularity embedding model
|
| 199 |
-
- `sentence-transformers/all-MiniLM-L6-v2` - Fast, small embedding model for general use
|
| 200 |
-
- `sentence-transformers/all-mpnet-base-v2` - Balanced performance embedding model
|
| 201 |
-
- `Snowflake/snowflake-arctic-embed-m` - Medium-sized Arctic embedding model
|
| 202 |
-
- `Snowflake/snowflake-arctic-embed-l` - Large Arctic embedding model
|
| 203 |
-
- `Snowflake/snowflake-arctic-embed-m-long` - Medium Arctic model optimized for long context
|
| 204 |
-
- `Snowflake/snowflake-arctic-embed-m-v2.0` - Latest Arctic embedding with multilingual support
|
| 205 |
-
- `BAAI/bge-large-en-v1.5` - Large BGE embedding model for English
|
| 206 |
-
- `BAAI/bge-base-en-v1.5` - Base BGE embedding model for English
|
| 207 |
-
- `BAAI/bge-small-en-v1.5` - Small BGE embedding model for English
|
| 208 |
-
- `sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2` - Multilingual paraphrase model
|
| 209 |
- `ibm-granite/granite-embedding-30m-english` - IBM Granite 30M English embedding model
|
| 210 |
- `ibm-granite/granite-embedding-278m-multilingual` - IBM Granite 278M multilingual embedding model
|
| 211 |
""")
|
|
@@ -216,4 +201,4 @@ if __name__ == '__main__':
|
|
| 216 |
|
| 217 |
# Run with Uvicorn (Gradio uses this internally)
|
| 218 |
import uvicorn
|
| 219 |
-
uvicorn.run(
|
|
|
|
| 77 |
}
|
| 78 |
)
|
| 79 |
|
| 80 |
+
except Exception as ex:
|
| 81 |
return JSONResponse(
|
| 82 |
status_code=500,
|
| 83 |
+
content={"error": str(ex)}
|
| 84 |
)
|
| 85 |
|
| 86 |
with gradio.Blocks(title="Multi-Model Text Embeddings", css="""
|
|
|
|
| 94 |
}
|
| 95 |
""") as gradio_app:
|
| 96 |
gradio.Markdown("# Multi-Model Text Embeddings")
|
| 97 |
+
gradio.Markdown("Generate embeddings for your text using the IBM Granite embedding models.")
|
|
|
|
| 98 |
|
| 99 |
# Model selector dropdown (allows custom input)
|
| 100 |
model_dropdown = gradio.Dropdown(
|
|
|
|
| 191 |
```
|
| 192 |
|
| 193 |
### Available Models
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 194 |
- `ibm-granite/granite-embedding-30m-english` - IBM Granite 30M English embedding model
|
| 195 |
- `ibm-granite/granite-embedding-278m-multilingual` - IBM Granite 278M multilingual embedding model
|
| 196 |
""")
|
|
|
|
| 201 |
|
| 202 |
# Run with Uvicorn (Gradio uses this internally)
|
| 203 |
import uvicorn
|
| 204 |
+
uvicorn.run(gradio_app, host="0.0.0.0", port=7860)
|