Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,9 +11,8 @@ def predict(text):
|
|
| 11 |
THRESHOLD = prompting.compute_tokens_prob(prompt, token_list1=["good"], token_list2= ["bad"])[0].item()
|
| 12 |
res=prompting.compute_tokens_prob(text+prompt, token_list1=["good"], token_list2= ["bad"])
|
| 13 |
if res[0] > THRESHOLD:
|
| 14 |
-
return {"POSITIVE":(res[0].item()-THRESHOLD)/ (1-THRESHOLD)}
|
| 15 |
-
return {"NEGATIVE":(THRESHOLD-res[0].item())/THRESHOLD}
|
| 16 |
-
|
| 17 |
|
| 18 |
import gradio as gr
|
| 19 |
iface = gr.Interface(fn=predict, inputs=["text"], outputs=["label"]).launch()
|
|
|
|
| 11 |
THRESHOLD = prompting.compute_tokens_prob(prompt, token_list1=["good"], token_list2= ["bad"])[0].item()
|
| 12 |
res=prompting.compute_tokens_prob(text+prompt, token_list1=["good"], token_list2= ["bad"])
|
| 13 |
if res[0] > THRESHOLD:
|
| 14 |
+
return {"POSITIVE":(res[0].item()-THRESHOLD)/ (1-THRESHOLD)}, (res[0].item()-THRESHOLD)/ (1-THRESHOLD)
|
| 15 |
+
return {"NEGATIVE":(THRESHOLD-res[0].item())/THRESHOLD},(THRESHOLD-res[0].item())/THRESHOLD
|
|
|
|
| 16 |
|
| 17 |
import gradio as gr
|
| 18 |
iface = gr.Interface(fn=predict, inputs=["text"], outputs=["label"]).launch()
|