Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,15 +17,26 @@ def analyze_sentiment(text):
|
|
| 17 |
sentiment = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 18 |
return sentiment
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
)
|
| 28 |
|
| 29 |
# Launch the app
|
| 30 |
-
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
sentiment = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 18 |
return sentiment
|
| 19 |
|
| 20 |
+
with gr.Blocks() as demo:
|
| 21 |
+
gr.Markdown("Enter Persian text to get its sentiment analyzed")
|
| 22 |
+
input_text = gr.Textbox(label="Status")
|
| 23 |
+
submit_button = gr.Button("Upload and Process")
|
| 24 |
+
output_text = gr.Textbox(label="Status")
|
| 25 |
+
|
| 26 |
+
submit_button.click(process_file, inputs=[input_text], outputs=output_text)
|
|
|
|
| 27 |
|
| 28 |
# Launch the app
|
| 29 |
+
demo.launch()
|
| 30 |
+
|
| 31 |
+
# # Define Gradio interface
|
| 32 |
+
# iface = gr.Interface(
|
| 33 |
+
# fn=analyze_sentiment,
|
| 34 |
+
# inputs="text",
|
| 35 |
+
# outputs="text",
|
| 36 |
+
# title="Persian Sentiment Analysis",
|
| 37 |
+
# description="Enter Persian text to get its sentiment analyzed."
|
| 38 |
+
# )
|
| 39 |
+
|
| 40 |
+
# # Launch the app
|
| 41 |
+
# if __name__ == "__main__":
|
| 42 |
+
# iface.launch(server_port=7865)
|