This project provides an interactive interface to find and generate emojis based on input text. The interface consists of an input box for entering text and two buttons: Submit and Next. When a user submits text, the system processes it through a BERT model and calculates cosine similarity to match emojis from a predefined dataset. If matching emojis are found, the top four emojis are displayed. By clicking the Next button, the user can generate an emoji using an API call to a fine-tuned model on a specific emoji dataset.
- Text Input: Input box to enter text for emoji search.
- Submit Button: Processes the input text and displays matching emojis.
- Next Button: Generates an emoji using a fine-tuned model via API call.
- Python 3.8 or higher
- Flask
- Transformers (HuggingFace)
- NumPy
- Requests
-
Clone the Repository
git clone https://github.com/your-repo/emoji-finder-generator.git cd emoji-finder-generator -
Install Dependencies
pip install -r requirements.txt
-
Run the Flask Application
export FLASK_APP=app.py flask run
-
Open the Application Open your web browser and go to
http://localhost:5000. -
Input Text Enter the text you want to analyze in the input box.
-
Submit Text Click the
Submitbutton. The text will be processed, and the top four matching emojis will be displayed if found. -
Generate Emoji Click the
Nextbutton to generate an emoji using the fine-tuned model via API call.
-
Text Processing
- The input text is passed through a pre-trained BERT model to obtain embeddings.
-
Cosine Similarity Calculation
- Cosine similarity is calculated between the text embeddings and the embeddings of emojis in the dataset.
-
Emoji Matching
- The top four matching emojis based on cosine similarity are displayed.
-
Emoji Generation
- Upon clicking the
Nextbutton, an API call is made to a server where a fine-tuned model generates an emoji based on the input text.
- Upon clicking the
The Next button triggers an API call to generate the emoji. Ensure the API endpoint is correctly configured in your application.
import Replicate from 'replicate';
const replicate = new Replicate();
const input = {
prompt: "A TOK emoji of a man",
apply_watermark: false
};
const output = await replicate.run("fofr/sdxl-emoji:dee76b5afde21b0f01ed7925f0665b7e879c50ee718c5f78a9d38e04d523cc5e", { input });
console.log(output)
//=> ["https://replicate.delivery/pbxt/a3z81v5vwlKfLq1H5uBqpVm...Feel free to fork this repository and contribute by submitting a pull request.
This project is licensed under the MIT License.