Spaces:
Sleeping
Sleeping
Commit
·
63e67d2
1
Parent(s):
4230c01
Update app.py
Browse files
app.py
CHANGED
@@ -13,9 +13,10 @@ class Input(BaseModel):
|
|
13 |
def predict_sentiment(input: Input, words):
|
14 |
input_ids = tokenizer(input.text, return_tensors="pt").input_ids
|
15 |
outputs = model.generate(input_ids, max_length=words)
|
16 |
-
|
|
|
17 |
|
18 |
|
19 |
-
iface = gr.Interface(fn=predict_sentiment, inputs=["text", gr.Slider(
|
20 |
|
21 |
iface.launch()
|
|
|
13 |
def predict_sentiment(input: Input, words):
|
14 |
input_ids = tokenizer(input.text, return_tensors="pt").input_ids
|
15 |
outputs = model.generate(input_ids, max_length=words)
|
16 |
+
decoded_output = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
17 |
+
return f"{decoded_output}"
|
18 |
|
19 |
|
20 |
+
iface = gr.Interface(fn=predict_sentiment, inputs=["text", gr.Slider(10, 100)], outputs="text")
|
21 |
|
22 |
iface.launch()
|