Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -58,3 +58,35 @@ def evaluate(instruction, input=None):
|
|
58 |
for s in generation_output.sequences:
|
59 |
output = tokenizer.decode(s)
|
60 |
print("Response:", output.split("### Response:")[1].strip())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
for s in generation_output.sequences:
|
59 |
output = tokenizer.decode(s)
|
60 |
print("Response:", output.split("### Response:")[1].strip())
|
61 |
+
|
62 |
+
|
63 |
+
def inference(text):
|
64 |
+
output = evaluate(instruction = instruction, input = input)
|
65 |
+
return output
|
66 |
+
|
67 |
+
io = gr.Interface(
|
68 |
+
inference,
|
69 |
+
gr.Textbox(
|
70 |
+
lines = 3, max_lines = 10,
|
71 |
+
placeholder = "Add question here",
|
72 |
+
interactive = True,
|
73 |
+
show_label = False
|
74 |
+
),
|
75 |
+
gr.Textbox(
|
76 |
+
lines = 3,
|
77 |
+
max_lines = 25,
|
78 |
+
placeholder = "add context here",
|
79 |
+
interactive = True,
|
80 |
+
show_label = False
|
81 |
+
),
|
82 |
+
outputs =[
|
83 |
+
gr.Textbox(lines = 2, label = 'Pythia410m output', interactive = False)
|
84 |
+
]
|
85 |
+
),
|
86 |
+
title = title,
|
87 |
+
description = description,
|
88 |
+
article = article,
|
89 |
+
examples = examples,
|
90 |
+
cache_examples = False,
|
91 |
+
)
|
92 |
+
io.launch()
|