Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -4,10 +4,17 @@ from peft import AutoPeftModelForSequenceClassification
|
|
| 4 |
|
| 5 |
tokenizer = AutoTokenizer.from_pretrained("distilbert-base-uncased")
|
| 6 |
loraModel = AutoPeftModelForSequenceClassification.from_pretrained("Intradiction/text_classification_WithLORA")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
# Handle calls to DistilBERT no LORA
|
| 8 |
distilBERTnoLORA_pipe = pipeline(model="Intradiction/text_classification_NoLORA")
|
| 9 |
distilBERTwithLORA_pipe = pipeline("sentiment-analysis", model=loraModel, tokenizer=tokenizer)
|
| 10 |
|
|
|
|
| 11 |
def distilBERTnoLORA_fn(text):
|
| 12 |
return distilBERTnoLORA_pipe(text)
|
| 13 |
|
|
@@ -106,15 +113,25 @@ with gr.Blocks(
|
|
| 106 |
<p>insert information on training parameters here</p>
|
| 107 |
""")
|
| 108 |
with gr.Column(scale=0.3,variant="panel"):
|
| 109 |
-
|
|
|
|
| 110 |
btn = gr.Button("Run")
|
| 111 |
gr.Examples(
|
| 112 |
[
|
| 113 |
-
"
|
| 114 |
-
"
|
| 115 |
-
"
|
| 116 |
],
|
| 117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
label="Try asking",
|
| 119 |
)
|
| 120 |
|
|
@@ -153,15 +170,25 @@ with gr.Blocks(
|
|
| 153 |
<p>insert information on training parameters here</p>
|
| 154 |
""")
|
| 155 |
with gr.Column(scale=0.3,variant="panel"):
|
| 156 |
-
|
|
|
|
| 157 |
btn = gr.Button("Run")
|
| 158 |
gr.Examples(
|
| 159 |
[
|
| 160 |
-
"
|
| 161 |
-
"
|
| 162 |
-
"
|
| 163 |
],
|
| 164 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
label="Try asking",
|
| 166 |
)
|
| 167 |
|
|
|
|
| 4 |
|
| 5 |
tokenizer = AutoTokenizer.from_pretrained("distilbert-base-uncased")
|
| 6 |
loraModel = AutoPeftModelForSequenceClassification.from_pretrained("Intradiction/text_classification_WithLORA")
|
| 7 |
+
|
| 8 |
+
#pretrained models
|
| 9 |
+
#Textclass_pipe = pipeline()
|
| 10 |
+
#STSmodel_pipe = pipeline()
|
| 11 |
+
#NLImodel_pipe = pipeline()
|
| 12 |
+
|
| 13 |
# Handle calls to DistilBERT no LORA
|
| 14 |
distilBERTnoLORA_pipe = pipeline(model="Intradiction/text_classification_NoLORA")
|
| 15 |
distilBERTwithLORA_pipe = pipeline("sentiment-analysis", model=loraModel, tokenizer=tokenizer)
|
| 16 |
|
| 17 |
+
|
| 18 |
def distilBERTnoLORA_fn(text):
|
| 19 |
return distilBERTnoLORA_pipe(text)
|
| 20 |
|
|
|
|
| 113 |
<p>insert information on training parameters here</p>
|
| 114 |
""")
|
| 115 |
with gr.Column(scale=0.3,variant="panel"):
|
| 116 |
+
nli_p1 = gr.Textbox(placeholder="Prompt One",label= "Enter Query")
|
| 117 |
+
nli_p2 = gr.Textbox(placeholder="Prompt Two",label= "Enter Query")
|
| 118 |
btn = gr.Button("Run")
|
| 119 |
gr.Examples(
|
| 120 |
[
|
| 121 |
+
"placeholder text",
|
| 122 |
+
"placeholder text",
|
| 123 |
+
"placeholder text",
|
| 124 |
],
|
| 125 |
+
nli_p1,
|
| 126 |
+
label="Try asking",
|
| 127 |
+
)
|
| 128 |
+
gr.Examples(
|
| 129 |
+
[
|
| 130 |
+
"placeholder text",
|
| 131 |
+
"placeholder text",
|
| 132 |
+
"placeholder text",
|
| 133 |
+
],
|
| 134 |
+
nli_p2,
|
| 135 |
label="Try asking",
|
| 136 |
)
|
| 137 |
|
|
|
|
| 170 |
<p>insert information on training parameters here</p>
|
| 171 |
""")
|
| 172 |
with gr.Column(scale=0.3,variant="panel"):
|
| 173 |
+
sts_p1 = gr.Textbox(placeholder="Prompt One",label= "Enter Query")
|
| 174 |
+
sts_p2 = gr.Textbox(placeholder="Prompt Two",label= "Enter Query")
|
| 175 |
btn = gr.Button("Run")
|
| 176 |
gr.Examples(
|
| 177 |
[
|
| 178 |
+
"placeholder text",
|
| 179 |
+
"placeholder text",
|
| 180 |
+
"placeholder text",
|
| 181 |
],
|
| 182 |
+
sts_p1,
|
| 183 |
+
label="Try asking",
|
| 184 |
+
)
|
| 185 |
+
gr.Examples(
|
| 186 |
+
[
|
| 187 |
+
"placeholder text",
|
| 188 |
+
"placeholder text",
|
| 189 |
+
"placeholder text",
|
| 190 |
+
],
|
| 191 |
+
sts_p2,
|
| 192 |
label="Try asking",
|
| 193 |
)
|
| 194 |
|