ram / file.py
tspsram's picture
Create file.py
4eb1fe5 verified
raw
history blame contribute delete
651 Bytes
# Install the required library if not already installed
!pip install transformers
from transformers import pipeline
# Initialize the emoji generation pipeline
emoji_generator = pipeline("text2emoji")
def translate_to_emojis(text):
"""
Translates input text into a sequence of emojis.
"""
try:
emojis = emoji_generator(text)
return " ".join(emojis)
except Exception as e:
return f"Oops! Something went wrong: {str(e)}"
# Get user input
user_text = input("Enter your text: ")
# Translate to emojis
translated_emojis = translate_to_emojis(user_text)
print("\nTranslated Emojis:")
print(translated_emojis)