Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| import inference | |
| # Define the function to classify text and return emojis | |
| def classify_text(text: str): | |
| if len(text.strip()) == 0: return "" | |
| result = inference.predict(text) | |
| if result == 1: | |
| return "π Yay! Thanks!" | |
| return "π We would improve." | |
| # Create the Gradio interface | |
| inface = gr.Interface(fn=classify_text, | |
| inputs="text", | |
| outputs="text", | |
| live=True, | |
| title="Review Classification", | |
| description="Enter some text and get a happy or sad emoji based on sentiment.") | |
| # Launch the web app | |
| inface.launch() | |