dejanseo commited on
Commit
91e5b48
·
verified ·
1 Parent(s): 767039c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -9
app.py CHANGED
@@ -1,23 +1,23 @@
1
  import streamlit as st
2
  import torch
3
- from transformers import AlbertTokenizer, AlbertForSequenceClassification, AutoModelForSequenceClassification, AutoTokenizer
4
  import plotly.graph_objects as go
5
 
6
  # URL of the logo
7
  logo_url = "https://dejan.ai/wp-content/uploads/2024/02/dejan-300x103.png"
8
 
9
- # Display the logo at the top using st.image
10
- st.image(logo_url, use_column_width=True)
11
 
12
  # Streamlit app title and description
13
- st.title("DEJAN AI Search Query Classifier")
 
14
  st.write("Enter a query to check if it's well-formed:")
15
- st.write("See [Dejan AI](https://dejan.ai/blog/search-query-quality-classifier/)")
16
 
17
- # Load the model and tokenizer from Hugging Face Hub
18
  model_name = 'dejanseo/Query-Quality-Classifier'
19
- tokenizer = AutoTokenizer.from_pretrained(model_name)
20
- model = AutoModelForSequenceClassification.from_pretrained(model_name)
21
 
22
  # Set the model to evaluation mode
23
  model.eval()
@@ -25,7 +25,8 @@ device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
25
  model.to(device)
26
 
27
  # User input
28
- user_input = st.text_input("Query:")
 
29
 
30
  def classify_query(query):
31
  # Tokenize input
 
1
  import streamlit as st
2
  import torch
3
+ from transformers import AlbertTokenizer, AlbertForSequenceClassification, AlbertConfig
4
  import plotly.graph_objects as go
5
 
6
  # URL of the logo
7
  logo_url = "https://dejan.ai/wp-content/uploads/2024/02/dejan-300x103.png"
8
 
9
+ # Display the logo at the top using st.logo
10
+ st.logo(logo_url, link="https://dejan.ai")
11
 
12
  # Streamlit app title and description
13
+ st.title("Search Query Form Classifier")
14
+ st.write("Ambiguous search queries are candidates for query expansion. Our model identifies such queries with an 80 percent accuracy and is deployed in a batch processing pipeline directly connected with Google Search Console API. In this demo you can test the model capability by testing individual queries.")
15
  st.write("Enter a query to check if it's well-formed:")
 
16
 
17
+ # Load the model and tokenizer from the Hugging Face Model Hub
18
  model_name = 'dejanseo/Query-Quality-Classifier'
19
+ tokenizer = AlbertTokenizer.from_pretrained(model_name)
20
+ model = AlbertForSequenceClassification.from_pretrained(model_name)
21
 
22
  # Set the model to evaluation mode
23
  model.eval()
 
25
  model.to(device)
26
 
27
  # User input
28
+ user_input = st.text_input("Query:", "What is?")
29
+ st.write("Developed by [Dejan AI](https://dejan.ai/blog/search-query-quality-classifier/)")
30
 
31
  def classify_query(query):
32
  # Tokenize input