Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,7 +10,12 @@ def text_to_emoji(text):
|
|
| 10 |
# Generate emoji output
|
| 11 |
result = generator(prompt, max_length=50, num_return_sequences=1)
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
return emoji_output
|
| 15 |
|
| 16 |
# Gradio Interface
|
|
@@ -20,4 +25,4 @@ iface = gr.Interface(fn=text_to_emoji,
|
|
| 20 |
title="Text-to-Emoji AI",
|
| 21 |
description="Enter a sentence and get the emoji equivalent!")
|
| 22 |
|
| 23 |
-
iface.launch()
|
|
|
|
| 10 |
# Generate emoji output
|
| 11 |
result = generator(prompt, max_length=50, num_return_sequences=1)
|
| 12 |
|
| 13 |
+
# Extract the emoji part from the generated text
|
| 14 |
+
emoji_output = result[0]['generated_text']
|
| 15 |
+
|
| 16 |
+
# Clean the output, removing unnecessary parts and keeping only emojis
|
| 17 |
+
emoji_output = emoji_output.split("->")[-1].strip()
|
| 18 |
+
|
| 19 |
return emoji_output
|
| 20 |
|
| 21 |
# Gradio Interface
|
|
|
|
| 25 |
title="Text-to-Emoji AI",
|
| 26 |
description="Enter a sentence and get the emoji equivalent!")
|
| 27 |
|
| 28 |
+
iface.launch()
|