Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from transformers import pipeline | |
| # Load the model and tokenizer from Hugging Face and create a pipeline | |
| model_pipeline = pipeline('feature-extraction', model='sentence-transformers/all-distilroberta-v1') | |
| # Define a function that uses the model to make predictions | |
| def predict(input_text): | |
| features = model_pipeline(input_text) | |
| return features | |
| # Create a Gradio interface | |
| interface = gr.Interface(fn=predict, inputs="text", outputs="json") | |
| # Launch the Gradio app | |
| interface.launch(share=True) | |