Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -63,40 +63,35 @@ def evaluate(instruction, input=None):
|
|
63 |
result.append( output.split("### Response:")[1].strip())
|
64 |
return ' '.join(el for el in result)
|
65 |
|
66 |
-
def inference(text, input):
|
|
|
|
|
67 |
output = evaluate(instruction = text, input = input)
|
68 |
return output
|
69 |
|
70 |
def choose_model(name):
|
71 |
return load_model(name), load_tokenizer(name)
|
72 |
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
placeholder = "Add context here",
|
95 |
-
interactive = True,
|
96 |
-
show_label = False
|
97 |
-
)],
|
98 |
-
outputs = [gr.Textbox(lines = 1, label = 'Pythia410m', interactive = False)],
|
99 |
-
cache_examples = False,
|
100 |
-
)
|
101 |
|
102 |
-
|
|
|
63 |
result.append( output.split("### Response:")[1].strip())
|
64 |
return ' '.join(el for el in result)
|
65 |
|
66 |
+
def inference(model_name, text, input):
|
67 |
+
model = load_model(model_name)
|
68 |
+
tokenizer = load_tokenizer(model_name)
|
69 |
output = evaluate(instruction = text, input = input)
|
70 |
return output
|
71 |
|
72 |
def choose_model(name):
|
73 |
return load_model(name), load_tokenizer(name)
|
74 |
|
75 |
+
io = gr.Interface(
|
76 |
+
inference,
|
77 |
+
inputs = [
|
78 |
+
gr.Dropdown(["s3nh/pythia-1.4b-deduped-16k-steps-self-instruct-polish", "s3nh/pythia-410m-91k-steps-self-instruct-polish"]),
|
79 |
+
gr.Textbox(
|
80 |
+
lines = 3,
|
81 |
+
max_lines = 10,
|
82 |
+
placeholder = "Add question here",
|
83 |
+
interactive = True,
|
84 |
+
show_label = False
|
85 |
+
),
|
86 |
+
gr.Textbox(
|
87 |
+
lines = 3,
|
88 |
+
max_lines = 10,
|
89 |
+
placeholder = "Add context here",
|
90 |
+
interactive = True,
|
91 |
+
show_label = False
|
92 |
+
)],
|
93 |
+
outputs = [gr.Textbox(lines = 1, label = 'Pythia410m', interactive = False)],
|
94 |
+
cache_examples = False,
|
95 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
+
io.launch(debug = True)
|