Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -49,15 +49,25 @@ def process_text_pipeline(text):
|
|
| 49 |
|
| 50 |
return "\n".join(processed_sentences)
|
| 51 |
|
| 52 |
-
#
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
gr.Markdown(
|
| 55 |
"""
|
| 56 |
<h1 style='text-align: center; font-size: 36px;'>π Sarcasm Detection for Customer Reviews π</h1>
|
| 57 |
-
<p style='text-align: center; font-size: 18px;'>
|
| 58 |
"""
|
| 59 |
)
|
| 60 |
-
|
| 61 |
with gr.Tab("Text Input"):
|
| 62 |
with gr.Row():
|
| 63 |
text_input = gr.Textbox(
|
|
@@ -66,7 +76,7 @@ with gr.Blocks(css=".gradio-container {background-color: #f3f4f6; color: #333; f
|
|
| 66 |
placeholder="Enter one or more sentences, each on a new line."
|
| 67 |
)
|
| 68 |
result_output = gr.Textbox(label="Results", lines=10, interactive=False)
|
| 69 |
-
analyze_button = gr.Button("π
|
| 70 |
|
| 71 |
analyze_button.click(process_text_pipeline, inputs=text_input, outputs=result_output)
|
| 72 |
|
|
@@ -80,12 +90,6 @@ with gr.Blocks(css=".gradio-container {background-color: #f3f4f6; color: #333; f
|
|
| 80 |
|
| 81 |
file_input.change(process_file, inputs=file_input, outputs=file_output)
|
| 82 |
|
| 83 |
-
gr.Markdown(
|
| 84 |
-
"""
|
| 85 |
-
<p style='text-align: center;'>Made with β€οΈ by <a href='https://huggingface.co/dnzblgn' target='_blank'>dnzblgn</a></p>
|
| 86 |
-
"""
|
| 87 |
-
)
|
| 88 |
-
|
| 89 |
# Run the interface
|
| 90 |
if __name__ == "__main__":
|
| 91 |
interface.launch()
|
|
|
|
| 49 |
|
| 50 |
return "\n".join(processed_sentences)
|
| 51 |
|
| 52 |
+
# Add CSS with background image
|
| 53 |
+
background_css = """
|
| 54 |
+
.gradio-container {
|
| 55 |
+
background-image: url('https://huggingface.co/spaces/dnzblgn/Sarcasm_Detection/resolve/main/image.png');
|
| 56 |
+
background-size: cover;
|
| 57 |
+
background-position: center;
|
| 58 |
+
color: white;
|
| 59 |
+
}
|
| 60 |
+
"""
|
| 61 |
+
|
| 62 |
+
# Gradio UI with updated background image
|
| 63 |
+
with gr.Blocks(css=background_css) as interface:
|
| 64 |
gr.Markdown(
|
| 65 |
"""
|
| 66 |
<h1 style='text-align: center; font-size: 36px;'>π Sarcasm Detection for Customer Reviews π</h1>
|
| 67 |
+
<p style='text-align: center; font-size: 18px;'>Analyze the sentiment of customer reviews and detect sarcasm in positive reviews.</p>
|
| 68 |
"""
|
| 69 |
)
|
| 70 |
+
|
| 71 |
with gr.Tab("Text Input"):
|
| 72 |
with gr.Row():
|
| 73 |
text_input = gr.Textbox(
|
|
|
|
| 76 |
placeholder="Enter one or more sentences, each on a new line."
|
| 77 |
)
|
| 78 |
result_output = gr.Textbox(label="Results", lines=10, interactive=False)
|
| 79 |
+
analyze_button = gr.Button("π Process")
|
| 80 |
|
| 81 |
analyze_button.click(process_text_pipeline, inputs=text_input, outputs=result_output)
|
| 82 |
|
|
|
|
| 90 |
|
| 91 |
file_input.change(process_file, inputs=file_input, outputs=file_output)
|
| 92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
# Run the interface
|
| 94 |
if __name__ == "__main__":
|
| 95 |
interface.launch()
|