Upload 2 files
Browse files- app.py +24 -0
- requirements.txt +5 -0
app.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
|
3 |
+
# Load the model
|
4 |
+
pipe = pipeline("text-classification", model="mgbam/roberta-yelp-genomic-bottleneck")
|
5 |
+
|
6 |
+
# Gradio app
|
7 |
+
import gradio as gr
|
8 |
+
|
9 |
+
def classify_text(text):
|
10 |
+
results = pipe(text)
|
11 |
+
return results
|
12 |
+
|
13 |
+
# Create Gradio interface
|
14 |
+
interface = gr.Interface(
|
15 |
+
fn=classify_text,
|
16 |
+
inputs="text",
|
17 |
+
outputs="json",
|
18 |
+
title="Text Classification",
|
19 |
+
description="Classify text using the RoBERTa-Yelp-Genomic-Bottleneck model."
|
20 |
+
)
|
21 |
+
|
22 |
+
if __name__ == "__main__":
|
23 |
+
interface.launch()
|
24 |
+
|
requirements.txt
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
transformers
|
2 |
+
torch
|
3 |
+
gradio
|
4 |
+
|
5 |
+
|