Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,16 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
|
4 |
+
# Load the model and tokenizer from Hugging Face and create a pipeline
|
5 |
+
model_pipeline = pipeline('feature-extraction', model='sentence-transformers/all-distilroberta-v1')
|
6 |
+
|
7 |
+
# Define a function that uses the model to make predictions
|
8 |
+
def predict(input_text):
|
9 |
+
features = model_pipeline(input_text)
|
10 |
+
return features
|
11 |
+
|
12 |
+
# Create a Gradio interface
|
13 |
+
interface = gr.Interface(fn=predict, inputs="text", outputs="json")
|
14 |
+
|
15 |
+
# Launch the Gradio app
|
16 |
+
interface.launch(share=True)
|