Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from transformers import pipeline | |
| #pipe = pipeline("text-classification", model="qualitydatalab/autotrain-car-review-project-966432121") | |
| def predict(text): | |
| label2emoji = {"poor": "π", "ok": "π", "great": "π"} | |
| #preds = pipe(text)[0] | |
| return label2emoji["poor"], round(1, 5) | |
| gradio_ui = gr.Interface( | |
| fn=predict, | |
| title="Predicting review scores from customer reviews on cars", | |
| description="Enter some review text about a car model and check what the model predicts for it's rating.", | |
| inputs=[ | |
| gr.inputs.Textbox(lines=5, label="Paste some text here"), | |
| ], | |
| outputs=[ | |
| gr.outputs.Textbox(label="Label"), | |
| gr.outputs.Textbox(label="Score"), | |
| ], | |
| examples=[ | |
| [" Bought this Clio for my daughter 2 years ago. It was very well cared for with 95,000 miles. New brakes, tires, and all scheduled maintenance was done. We have had no problems (ex a torn axle boot) in 2 years and 22,000 miles. This is our favorite car (we have 4) as it has a great balance of economy, handling, comfort, and build quality."], | |
| ["I bought a brand new Scenic for my daily driver last year, and this is my biggest mistake! I should of do more researches before buying it. This car is the MOST POS ever. My suspension was bad after a couple thousand miles, the car made huge noise when the car is rolling."], | |
| ], | |
| allow_flagging="never", | |
| analytics_enabled=False | |
| ) | |
| gradio_ui.launch(server_port=8080, enable_queue=False) |