Spaces:
Runtime error
Runtime error
added examples
Browse files
app.py
CHANGED
|
@@ -14,11 +14,20 @@ def classify_text(plot):
|
|
| 14 |
predictions = pipe(plot)[0]
|
| 15 |
return {label_map[pred['label']]: float(pred['score']) for pred in predictions}
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
iface = gr.Interface(
|
| 18 |
description = "Enter a title for a reddit post, and the model will attempt to predict the subreddit.",
|
| 19 |
article = "<p style='text-align: center'><a href='https://github.com/daspartho/predict-subreddit' target='_blank'>Github</a></p>",
|
| 20 |
fn=classify_text,
|
| 21 |
inputs=gr.inputs.Textbox(label="Type the title here"),
|
| 22 |
outputs=gr.outputs.Label(label='What the model thinks'),
|
|
|
|
| 23 |
)
|
| 24 |
iface.launch()
|
|
|
|
| 14 |
predictions = pipe(plot)[0]
|
| 15 |
return {label_map[pred['label']]: float(pred['score']) for pred in predictions}
|
| 16 |
|
| 17 |
+
examples = [
|
| 18 |
+
["My frying pan dried with a spot that looks like a pig"],
|
| 19 |
+
["Adult peer pressure is hearing your neighbor mowing so you decide you better mow too"],
|
| 20 |
+
['a bear walks into a bar and says, "give me a whiskey and... cola"'],
|
| 21 |
+
["Worst Celebrity Private Jet CO2 Emissions Offenders (2022)"],
|
| 22 |
+
["Billionaire No More: Patagonia Founder Gives Away the Company - Profits will now go towards climate action"],
|
| 23 |
+
]
|
| 24 |
+
|
| 25 |
iface = gr.Interface(
|
| 26 |
description = "Enter a title for a reddit post, and the model will attempt to predict the subreddit.",
|
| 27 |
article = "<p style='text-align: center'><a href='https://github.com/daspartho/predict-subreddit' target='_blank'>Github</a></p>",
|
| 28 |
fn=classify_text,
|
| 29 |
inputs=gr.inputs.Textbox(label="Type the title here"),
|
| 30 |
outputs=gr.outputs.Label(label='What the model thinks'),
|
| 31 |
+
examples=examples
|
| 32 |
)
|
| 33 |
iface.launch()
|