File size: 972 Bytes
1f78700
d2f39a7
1f78700
 
 
d2f39a7
1f78700
d2f39a7
 
1f78700
 
 
 
 
 
 
d2f39a7
1f78700
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr


from transformers import pipeline, AutoTokenizer, AutoModel

pipe = pipeline("text-generation", model="furquan/opt_2_7_b_prompt_tuned_sentiment_analysis", trust_remote_code=True)

# tokenizer = AutoTokenizer.from_pretrained("furquan/opt_2_7_b_prompt_tuned_sentiment_analysis", trust_remote_code=True)
# model = AutoModel.from_pretrained("furquan/opt_2_7_b_prompt_tuned_sentiment_analysis",trust_remote_code=True)

title = "OPT-2.7B"
description = "This demo uses meta's opt-2.7b model prompt tuned on the Stanford Sentiment Treebank-5 way dataset to only output the sentiment of a given text."
article = "<p style='text-align: center'><a href='https://arxiv.org/pdf/2104.08691.pdf' target='_blank'>The Power of Scale for Parameter-Efficient Prompt Tuning</a></p>"


def sentiment(text):
    return pipe(text)

iface = gr.Interface(fn=sentiment, inputs="text", outputs="text", title=title,
    description=description, article=article)
iface.launch()