oceankim commited on
Commit
5b3cb2f
1 Parent(s): 644fc5a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -8,7 +8,7 @@ tokenizer = BertTokenizer.from_pretrained('ProsusAI/finbert')
8
  # Load pre-trained model
9
  model = BertForSequenceClassification.from_pretrained('ProsusAI/finbert')
10
 
11
- def get_sentiment(입력):
12
  # Encode the text
13
  tokens = tokenizer.encode_plus(sec_text, add_special_tokens=True, return_tensors="pt")
14
 
@@ -24,12 +24,20 @@ def get_sentiment(입력):
24
  # Return the sentiment analysis result
25
  return f"{sentiment} Sentiment"
26
 
 
 
 
 
 
 
 
27
  # Define the Gradio interface
28
  gr_interface = gr.Interface(
29
  fn=get_sentiment,
30
- inputs=gr.Textbox(lines=1, placeholder="..."),
31
  outputs="text",
32
- title="Sentiment Analysis"
 
33
  )
34
 
35
  # Launch the interface
 
8
  # Load pre-trained model
9
  model = BertForSequenceClassification.from_pretrained('ProsusAI/finbert')
10
 
11
+ def get_sentiment(sec_text): # Ensure the parameter name matches the placeholder name.
12
  # Encode the text
13
  tokens = tokenizer.encode_plus(sec_text, add_special_tokens=True, return_tensors="pt")
14
 
 
24
  # Return the sentiment analysis result
25
  return f"{sentiment} Sentiment"
26
 
27
+ # Custom CSS to center the title
28
+ custom_css = """
29
+ .title {
30
+ text-align: center;
31
+ }
32
+ """
33
+
34
  # Define the Gradio interface
35
  gr_interface = gr.Interface(
36
  fn=get_sentiment,
37
+ inputs=gr.Textbox(lines=1, placeholder=""),
38
  outputs="text",
39
+ title="Sentiment Analysis",
40
+ css=custom_css # Add the custom CSS to the Interface
41
  )
42
 
43
  # Launch the interface