scaraliu commited on
Commit
eae8754
1 Parent(s): 1669926

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -1
app.py CHANGED
@@ -1,3 +1,16 @@
1
  import gradio as gr
 
2
 
3
- gr.load("models/sentence-transformers/all-distilroberta-v1").launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
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)