Spaces:
Runtime error
Runtime error
model examples update
Browse files
app.py
CHANGED
@@ -14,23 +14,23 @@ examples = [
|
|
14 |
]
|
15 |
|
16 |
# Descriptions for each models
|
17 |
-
descriptions = "Interview question remake is a model that..."
|
18 |
|
19 |
# pass in Strings of model choice and input text for context
|
20 |
def genQuestion(model_choice, context):
|
21 |
-
global descriptions
|
22 |
if model_choice=="interview-question-remake":
|
23 |
model = BartForConditionalGeneration.from_pretrained("hyechanjun/interview-question-remake")
|
24 |
tok = BartTokenizer.from_pretrained("hyechanjun/interview-question-remake")
|
25 |
-
descriptions = "Interview question remake is a model that..."
|
26 |
elif model_choice=="interview-length-tagged":
|
27 |
model = BartForConditionalGeneration.from_pretrained("hyechanjun/interview-length-tagged")
|
28 |
tok = BartTokenizer.from_pretrained("hyechanjun/interview-length-tagged")
|
29 |
-
descriptions = "Interview question tagged is a model that..."
|
30 |
elif model_choice=="reverse-interview-question":
|
31 |
model = BartForConditionalGeneration.from_pretrained("hyechanjun/reverse-interview-question")
|
32 |
tok = BartTokenizer.from_pretrained("hyechanjun/reverse-interview-question")
|
33 |
-
descriptions = "Reverse interview question is a model that..."
|
34 |
|
35 |
inputs = tok(context, return_tensors="pt")
|
36 |
output = model.generate(inputs["input_ids"], num_beams=4, max_length=64, min_length=9, num_return_sequences=4, diversity_penalty =1.0, num_beam_groups=2)
|
@@ -39,7 +39,7 @@ def genQuestion(model_choice, context):
|
|
39 |
for i in range(4):
|
40 |
final_output += [tok.decode(beam, skip_special_tokens=True, clean_up_tokenization_spaces=False) for beam in output][i] + "\n"
|
41 |
|
42 |
-
return final_output
|
43 |
|
44 |
iface = gr.Interface(fn=genQuestion, inputs=[gr.inputs.Dropdown(["interview-question-remake", "interview-length-tagged", "reverse-interview-question"]), "text"], examples=examples, description=descriptions, outputs="text")
|
45 |
iface.launch()
|
|
|
14 |
]
|
15 |
|
16 |
# Descriptions for each models
|
17 |
+
# descriptions = "Interview question remake is a model that..."
|
18 |
|
19 |
# pass in Strings of model choice and input text for context
|
20 |
def genQuestion(model_choice, context):
|
21 |
+
# global descriptions
|
22 |
if model_choice=="interview-question-remake":
|
23 |
model = BartForConditionalGeneration.from_pretrained("hyechanjun/interview-question-remake")
|
24 |
tok = BartTokenizer.from_pretrained("hyechanjun/interview-question-remake")
|
25 |
+
# descriptions = "Interview question remake is a model that..."
|
26 |
elif model_choice=="interview-length-tagged":
|
27 |
model = BartForConditionalGeneration.from_pretrained("hyechanjun/interview-length-tagged")
|
28 |
tok = BartTokenizer.from_pretrained("hyechanjun/interview-length-tagged")
|
29 |
+
# descriptions = "Interview question tagged is a model that..."
|
30 |
elif model_choice=="reverse-interview-question":
|
31 |
model = BartForConditionalGeneration.from_pretrained("hyechanjun/reverse-interview-question")
|
32 |
tok = BartTokenizer.from_pretrained("hyechanjun/reverse-interview-question")
|
33 |
+
# descriptions = "Reverse interview question is a model that..."
|
34 |
|
35 |
inputs = tok(context, return_tensors="pt")
|
36 |
output = model.generate(inputs["input_ids"], num_beams=4, max_length=64, min_length=9, num_return_sequences=4, diversity_penalty =1.0, num_beam_groups=2)
|
|
|
39 |
for i in range(4):
|
40 |
final_output += [tok.decode(beam, skip_special_tokens=True, clean_up_tokenization_spaces=False) for beam in output][i] + "\n"
|
41 |
|
42 |
+
return final_output
|
43 |
|
44 |
iface = gr.Interface(fn=genQuestion, inputs=[gr.inputs.Dropdown(["interview-question-remake", "interview-length-tagged", "reverse-interview-question"]), "text"], examples=examples, description=descriptions, outputs="text")
|
45 |
iface.launch()
|