Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -37,7 +37,7 @@ def autocomplete(query):
|
|
| 37 |
# Fuzzy matching with typo tolerance
|
| 38 |
matches = process.extract(query, autocomplete_data, scorer=fuzz.partial_ratio, limit=5)
|
| 39 |
|
| 40 |
-
# Return
|
| 41 |
return [match[0] for match in matches]
|
| 42 |
|
| 43 |
# Gradio interface
|
|
@@ -45,7 +45,7 @@ with gr.Blocks() as demo:
|
|
| 45 |
gr.Markdown("### Improved Autocomplete for Luxury Products")
|
| 46 |
|
| 47 |
query = gr.Textbox(label="Start typing for autocomplete")
|
| 48 |
-
autocomplete_output = gr.Textbox(label="Autocomplete Suggestions", lines=5)
|
| 49 |
|
| 50 |
# Trigger autocomplete on change
|
| 51 |
query.change(fn=autocomplete, inputs=query, outputs=autocomplete_output)
|
|
|
|
| 37 |
# Fuzzy matching with typo tolerance
|
| 38 |
matches = process.extract(query, autocomplete_data, scorer=fuzz.partial_ratio, limit=5)
|
| 39 |
|
| 40 |
+
# Return list of suggestions (Gradio will display them in separate lines)
|
| 41 |
return [match[0] for match in matches]
|
| 42 |
|
| 43 |
# Gradio interface
|
|
|
|
| 45 |
gr.Markdown("### Improved Autocomplete for Luxury Products")
|
| 46 |
|
| 47 |
query = gr.Textbox(label="Start typing for autocomplete")
|
| 48 |
+
autocomplete_output = gr.Textbox(label="Autocomplete Suggestions", lines=5, interactive=False)
|
| 49 |
|
| 50 |
# Trigger autocomplete on change
|
| 51 |
query.change(fn=autocomplete, inputs=query, outputs=autocomplete_output)
|