File size: 525 Bytes
1669926
eae8754
1669926
eae8754
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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)