Update app.py
Browse files
app.py
CHANGED
|
@@ -63,7 +63,7 @@ with gr.Blocks() as demo:
|
|
| 63 |
gr.Markdown("""# Enter anything and press Enter""")
|
| 64 |
|
| 65 |
topic_input = gr.Textbox(
|
| 66 |
-
label="Enter
|
| 67 |
)
|
| 68 |
|
| 69 |
output = gr.Textbox(
|
|
@@ -77,16 +77,18 @@ with gr.Blocks() as demo:
|
|
| 77 |
)
|
| 78 |
|
| 79 |
gr.Markdown("""
|
| 80 |
-
#
|
| 81 |
|
| 82 |
-
- **
|
| 83 |
-
- **
|
| 84 |
-
- **FAISS**
|
| 85 |
-
- **
|
|
|
|
|
|
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
-
**To
|
| 90 |
- **ID500: Basketball player LeBron James jioned 76er with a 5m/year contract.**
|
| 91 |
- **ID501: Spain won 2026 Football World Cup, defeating Argentina at final.**
|
| 92 |
- **ID502: Baseball player Shohei Ohtani plays as a hitter and as a pitcher, a rare two-way player.**
|
|
|
|
| 63 |
gr.Markdown("""# Enter anything and press Enter""")
|
| 64 |
|
| 65 |
topic_input = gr.Textbox(
|
| 66 |
+
label="Enter here"
|
| 67 |
)
|
| 68 |
|
| 69 |
output = gr.Textbox(
|
|
|
|
| 77 |
)
|
| 78 |
|
| 79 |
gr.Markdown("""
|
| 80 |
+
# Workflow:
|
| 81 |
|
| 82 |
+
- **Data pipeline. Get 500 news from ag_news dataset, and truncate each news to 130 characters**
|
| 83 |
+
- **Model BAAI/bge-v1.5 embeds the dataset and user input into vectors**
|
| 84 |
+
- **FAISS computes the semantic similarity between user-input-vector and each vector else**
|
| 85 |
+
- **Retrieve the top3 most relevant news based on semantic similarity, and show them to user**
|
| 86 |
+
- **Added custom news to test the retrieved results and make sure everything works**
|
| 87 |
+
- **Deploy UI**
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
+
**To test and have some fun, I made 3 news.:**
|
| 92 |
- **ID500: Basketball player LeBron James jioned 76er with a 5m/year contract.**
|
| 93 |
- **ID501: Spain won 2026 Football World Cup, defeating Argentina at final.**
|
| 94 |
- **ID502: Baseball player Shohei Ohtani plays as a hitter and as a pitcher, a rare two-way player.**
|