Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -72,26 +72,20 @@ def analyze_sentiment(sentence):
|
|
| 72 |
"score": rf_model.predict_proba([sentence]).max()}
|
| 73 |
|
| 74 |
return sentence, results
|
| 75 |
-
# Define a custom extra small size
|
| 76 |
-
text_xxs = gr.themes.Size(
|
| 77 |
-
name="text_xxs",
|
| 78 |
-
xxs=10, # You can adjust this value to get your desired font size
|
| 79 |
-
xs=12,
|
| 80 |
-
sm=14,
|
| 81 |
-
md=16,
|
| 82 |
-
lg=18,
|
| 83 |
-
xl=20,
|
| 84 |
-
xxl=22
|
| 85 |
-
)
|
| 86 |
|
| 87 |
-
# Create a custom theme with extra small font size
|
| 88 |
-
custom_theme = gr.themes.Default(
|
| 89 |
-
text_size=text_xxs, # Use our custom extra small size
|
| 90 |
-
font=[gr.themes.GoogleFont("Source Sans Pro"), "Arial", "sans-serif"]
|
| 91 |
-
)
|
| 92 |
|
| 93 |
-
#
|
| 94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
gr.Markdown("# Compare Sentiment Analysis Across Models")
|
| 96 |
gr.Markdown("Select a sentence to see sentiment analysis results from multiple models.")
|
| 97 |
|
|
@@ -101,4 +95,4 @@ with gr.Blocks(theme=custom_theme) as demo:
|
|
| 101 |
|
| 102 |
dropdown.change(analyze_sentiment, inputs=[dropdown], outputs=[text_output, sentiment_output])
|
| 103 |
|
| 104 |
-
demo.launch()
|
|
|
|
| 72 |
"score": rf_model.predict_proba([sentence]).max()}
|
| 73 |
|
| 74 |
return sentence, results
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
|
| 77 |
+
# Define custom CSS to reduce font size
|
| 78 |
+
custom_css = """
|
| 79 |
+
.gradio-container {
|
| 80 |
+
font-size: 0.7rem !important;
|
| 81 |
+
}
|
| 82 |
+
.gradio-container .output-markdown, .gradio-container .input-markdown {
|
| 83 |
+
font-size: 0.7rem !important;
|
| 84 |
+
}
|
| 85 |
+
"""
|
| 86 |
+
|
| 87 |
+
# Create Gradio interface with custom CSS
|
| 88 |
+
with gr.Blocks(css=custom_css) as demo:
|
| 89 |
gr.Markdown("# Compare Sentiment Analysis Across Models")
|
| 90 |
gr.Markdown("Select a sentence to see sentiment analysis results from multiple models.")
|
| 91 |
|
|
|
|
| 95 |
|
| 96 |
dropdown.change(analyze_sentiment, inputs=[dropdown], outputs=[text_output, sentiment_output])
|
| 97 |
|
| 98 |
+
demo.launch()
|