Danielrahmai1991 commited on
Commit
f6af93a
·
verified ·
1 Parent(s): 7c52699

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -10
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
- # Define Gradio interface
21
- iface = gr.Interface(
22
- fn=analyze_sentiment,
23
- inputs="text",
24
- outputs="text",
25
- title="Persian Sentiment Analysis",
26
- description="Enter Persian text to get its sentiment analyzed."
27
- )
28
 
29
  # Launch the app
30
- if __name__ == "__main__":
31
- iface.launch(server_port=7865)
 
 
 
 
 
 
 
 
 
 
 
 
 
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)