Th3r0 commited on
Commit
d0c2cdc
1 Parent(s): 43d5145

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -10
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
- inp = gr.Textbox(placeholder="Prompt",label= "Enter Query")
 
110
  btn = gr.Button("Run")
111
  gr.Examples(
112
  [
113
- "I thought this was a bit contrived",
114
- "You would need to be a child to enjoy this",
115
- "Drive more like Drive away",
116
  ],
117
- inp,
 
 
 
 
 
 
 
 
 
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
- inp = gr.Textbox(placeholder="Prompt",label= "Enter Query")
 
157
  btn = gr.Button("Run")
158
  gr.Examples(
159
  [
160
- "I thought this was a bit contrived",
161
- "You would need to be a child to enjoy this",
162
- "Drive more like Drive away",
163
  ],
164
- inp,
 
 
 
 
 
 
 
 
 
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