Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from transformers import pipeline | |
| sentiment = pipeline("sentiment-analysis") | |
| def get_sentiment(input_text): | |
| return sentiment(input_text) | |
| iface = gr.Interface(fn = get_sentiment, | |
| inputs = "text", | |
| outputs = ['text'], | |
| title = 'Sentiment Analysis', | |
| description="Get Sentiment Negative/Positive for the given input") | |
| iface.launch(inline = False) | |
| """ | |
| import gradio as gr | |
| from sentence_transformers import SentenceTransformer | |
| model_Q = SentenceTransformer('flax-sentence-embeddings/multi-QA_v1-mpnet-asymmetric-Q') | |
| def getVectors(sentences): | |
| vectors = [] | |
| splitSentences = sentences.split('/*/') | |
| for sentence in sentences: | |
| vectors.append(model_Q.encode(sentence)) | |
| return vectors | |
| interface = gr.Interface(fn = getVectors, | |
| inputs = "text", | |
| outputs = ['text'], | |
| title = 'get vectors', | |
| description = 'get vectors for search') | |
| interface.launch(inline = False) | |
| """ |