Spaces:
Runtime error
Runtime error
File size: 1,512 Bytes
6586b22 724e312 6586b22 890df00 724e312 6586b22 e15c6db 6586b22 e5212e9 890df00 6586b22 2175451 6586b22 ed68d06 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
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) |