Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
File size: 1,703 Bytes
cf957e4 e02eeb5 cf957e4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
"""
Main application file for the Emoji Mashup app.
This module handles the Gradio interface and application setup.
"""
import gradio as gr
from utils import logger
from emoji_processor import EmojiProcessor
class EmojiMashupApp:
def __init__(self):
"""Initialize the Gradio application."""
logger.info("Initializing Emoji Mashup App")
self.processor = EmojiProcessor()
self.processor.load_emoji_dictionaries()
def create_interface(self):
"""Create and configure the Gradio interface.
Returns:
Gradio Interface object
"""
return gr.Interface(
fn=self.processor.sentence_to_emojis,
inputs=gr.Textbox(lines=2, placeholder="Type a sentence..."),
outputs=[
gr.Text(label="Top Emotion Emoji"),
gr.Text(label="Top Event Emoji"),
gr.Image(label="Mashup Emoji")
],
title="Sentence → Emoji Mashup",
description="Get the top emotion and event emoji from your sentence, and view the mashup!",
examples=[
["I feel so happy today!"],
["I'm really angry right now"],
["Feeling tired after a long day"]
]
)
def run(self, share=True):
"""Launch the Gradio application.
Args:
share: Whether to create a public sharing link
"""
logger.info("Starting Emoji Mashup App")
interface = self.create_interface()
interface.launch(share=share)
# Main entry point
if __name__ == "__main__":
app = EmojiMashupApp()
app.run(share=True) |