Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -43,7 +43,17 @@ user_friendly_name_list = list(user_friendly_name.values())
|
|
43 |
#demo = gr.Interface.from_pipeline(pipe)
|
44 |
#demo.launch()
|
45 |
|
46 |
-
predict
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
inputs = [
|
49 |
gr.Textbox(label="Text", value=app_examples[0][0]),
|
|
|
43 |
#demo = gr.Interface.from_pipeline(pipe)
|
44 |
#demo.launch()
|
45 |
|
46 |
+
def predict(s1, chosen_model):
|
47 |
+
# Get model name from user-friendly name
|
48 |
+
full_chosen_model_name = chosen_model
|
49 |
+
|
50 |
+
# Initialize the pipeline with the chosen model
|
51 |
+
model_pipeline = pipeline("text-classification", model=full_chosen_model_name)
|
52 |
+
|
53 |
+
# Perform inference on the input text
|
54 |
+
predicted_label = model_pipeline(s1)[0] # Assuming your model returns a single prediction
|
55 |
+
|
56 |
+
return scores
|
57 |
|
58 |
inputs = [
|
59 |
gr.Textbox(label="Text", value=app_examples[0][0]),
|