gamza commited on
Commit
04b542d
β€’
1 Parent(s): 6aebb80

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -6,7 +6,10 @@ import numpy as np
6
  import pandas as pd
7
  from utils import test_sentences
8
 
9
- model = torch.load('bert_classification(0.87).pt')
 
 
 
10
 
11
  # Gradio μΈν„°νŽ˜μ΄μŠ€μ—μ„œ μ‚¬μš©ν•  ν•¨μˆ˜ μ •μ˜
12
  def predict_sentiment(text):
@@ -24,8 +27,8 @@ description = "β–ΆνŠΈμœ„ν„° 감정 μ•Œμ•„λ³΄κΈ°"
24
 
25
  tweet = gr.Interface(
26
  fn=predict_sentiment,
27
- inputs=gr.inputs.Textbox(placeholder="Enter tweet here..."),
28
- outputs=gr.outputs.Textbox(label="Sentiment Prediction"),
29
  title=title,
30
  theme="finlaymacklon/boxy_violet",
31
  description=description
 
6
  import pandas as pd
7
  from utils import test_sentences
8
 
9
+
10
+ # λͺ¨λΈμ„ 뢈러올 λ•Œ map_location=torch.device('cpu')둜 μ„€μ •ν•˜μ—¬ CPU에 λ‘œλ“œν•©λ‹ˆλ‹€.
11
+ model = torch.load('bert_classification(0.87).pt', map_location=torch.device('cpu'))
12
+
13
 
14
  # Gradio μΈν„°νŽ˜μ΄μŠ€μ—μ„œ μ‚¬μš©ν•  ν•¨μˆ˜ μ •μ˜
15
  def predict_sentiment(text):
 
27
 
28
  tweet = gr.Interface(
29
  fn=predict_sentiment,
30
+ inputs="text",
31
+ outputs="text",
32
  title=title,
33
  theme="finlaymacklon/boxy_violet",
34
  description=description