Spaces:
Running
Running
File size: 1,342 Bytes
fdc8d37 eb10851 fdc8d37 9de7bc2 eb10851 9de7bc2 eb10851 9de7bc2 eb10851 9de7bc2 eb10851 9de7bc2 eb10851 9de7bc2 eb10851 fdc8d37 eb10851 fdc8d37 eb10851 9de7bc2 eb10851 9de7bc2 eb10851 ac5bf8b eb10851 ac5bf8b eb10851 a74c089 eb10851 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
"""
Hugging Face Spaces compatible app
"""
import os
import gradio as gr
from main import app as fastapi_app
# Gradio wrapper cho Hugging Face Spaces
def create_gradio_interface():
"""
Tạo Gradio interface để deploy trên Hugging Face Spaces
"""
with gr.Blocks(title="Event Social Media Embeddings API") as demo:
gr.Markdown("""
# 🔍 Event Social Media Embeddings API
API để embeddings và search multimodal (text + images) với **Jina CLIP v2** + **Qdrant Cloud**
## 🌟 Features:
- ✅ Multimodal: Text + Image embeddings
- ✅ Tiếng Việt: 100% support
- ✅ High Performance: ONNX + HNSW
- ✅ Cloud: Qdrant Cloud
## 📡 API Endpoints:
- `POST /index` - Index data
- `POST /search` - Hybrid search
- `POST /search/text` - Text search
- `POST /search/image` - Image search
### 🔗 API Docs:
Truy cập `/docs` để xem API documentation đầy đủ
""")
gr.Markdown("### API is running at the `/docs` endpoint")
return demo
# Mount FastAPI app
demo = create_gradio_interface()
# Wrap FastAPI với Gradio
app = gr.mount_gradio_app(fastapi_app, demo, path="/")
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=7860)
|