Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -124,83 +124,4 @@ def search_products(
|
|
124 |
"data": results,
|
125 |
"totalpages": total_pages,
|
126 |
"currentpage": page
|
127 |
-
}
|
128 |
-
|
129 |
-
import gradio as gr
|
130 |
-
|
131 |
-
# Introduction and About Section
|
132 |
-
about_md = """
|
133 |
-
# Semantic Search API
|
134 |
-
|
135 |
-
Welcome to my Semantic Search project! This app showcases an API for searching fashion products using **semantic embeddings**.
|
136 |
-
|
137 |
-
## API Details
|
138 |
-
- **Base URL**: [https://MohamedAshraf701-Semantic-Search.hf.space](https://MohamedAshraf701-Semantic-Search.hf.space)
|
139 |
-
- **Search Endpoint**: `/products`
|
140 |
-
- Example Query:
|
141 |
-
```bash
|
142 |
-
curl --location --request GET 'https://MohamedAshraf701-Semantic-Search.hf.space/products?query=black&page=1&items_per_page=1'
|
143 |
-
```
|
144 |
-
- Response Format:
|
145 |
-
```json
|
146 |
-
{
|
147 |
-
"status": 200,
|
148 |
-
"data": [
|
149 |
-
{
|
150 |
-
"productDisplayName": "Black T-Shirt",
|
151 |
-
"baseColour": "Black",
|
152 |
-
"masterCategory": "Apparel",
|
153 |
-
"gender": "Men",
|
154 |
-
"image": "BASE64_STRING"
|
155 |
-
}
|
156 |
-
],
|
157 |
-
"totalpages": 10,
|
158 |
-
"currentpage": 1
|
159 |
-
}
|
160 |
-
```
|
161 |
-
|
162 |
-
## Technologies Used
|
163 |
-
- **Model**: [sentence-transformers/multi-qa-mpnet-base-cos-v1](https://huggingface.co/sentence-transformers/multi-qa-mpnet-base-cos-v1)
|
164 |
-
- **Dataset**: [Fashion Product Images](https://huggingface.co/datasets/ashraq/fashion-product-images-small)
|
165 |
-
- **Framework**: FastAPI for backend
|
166 |
-
- **Semantic Search**: Implemented using embeddings for efficient and accurate results.
|
167 |
-
|
168 |
-
## About Me
|
169 |
-
I am a **Python** and **Node.js** developer passionate about AI and machine learning. Check out my other projects:
|
170 |
-
- [Hugging Face Profile](https://huggingface.co/MohamedAshraf701)
|
171 |
-
- [GitHub](https://github.com/MohamedAshraf701)
|
172 |
-
"""
|
173 |
-
|
174 |
-
# Gradio Interface
|
175 |
-
def show_about():
|
176 |
-
return about_md
|
177 |
-
|
178 |
-
with gr.Blocks(theme=gr.themes.Default()) as demo:
|
179 |
-
gr.Markdown("# Semantic Search")
|
180 |
-
gr.Markdown("This application showcases the Semantic Search API built using advanced embeddings.")
|
181 |
-
|
182 |
-
with gr.Tab("API Details"):
|
183 |
-
gr.Markdown(about_md)
|
184 |
-
|
185 |
-
with gr.Tab("My Work"):
|
186 |
-
gr.Markdown("""
|
187 |
-
## Highlights
|
188 |
-
- **Semantic Search API**: Powered by Sentence Transformers for accurate product recommendations.
|
189 |
-
- **Technologies**: FastAPI, Hugging Face datasets, and sentence-transformers.
|
190 |
-
|
191 |
-
## Other Work
|
192 |
-
- [Sentence Correction](https://huggingface.co/spaces/MohamedAshraf701/sentence-corrector)
|
193 |
-
- [Query Response AI](https://huggingface.co/spaces/MohamedAshraf701/query-response-ai)
|
194 |
-
- [Portfolio](https://ashraf.digital)
|
195 |
-
""")
|
196 |
-
|
197 |
-
with gr.Tab("Contact"):
|
198 |
-
gr.Markdown("## Let's Connect!")
|
199 |
-
gr.Markdown("""
|
200 |
-
- **Email**: [email protected]
|
201 |
-
- **Twitter**: [@mohamedashraf](https://twitter.com/mohamedashraf)
|
202 |
-
- **LinkedIn**: [Profile](https://linkedin.com/in/mohamedashraf)
|
203 |
-
""")
|
204 |
-
|
205 |
-
# Launch the Gradio App
|
206 |
-
demo.launch()
|
|
|
124 |
"data": results,
|
125 |
"totalpages": total_pages,
|
126 |
"currentpage": page
|
127 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|