Spaces:
Runtime error
Runtime error
Commit
·
8fa0f4a
1
Parent(s):
97842c5
Change order and run inference on one example
Browse files
app.py
CHANGED
@@ -23,11 +23,6 @@ icon = "🍣"
|
|
23 |
st.set_page_config(page_title=title, page_icon=icon)
|
24 |
st.title(title)
|
25 |
|
26 |
-
# Load csv
|
27 |
-
uploaded_file = st.file_uploader("Choose a csv file", type="csv", key='file_uploader')
|
28 |
-
if uploaded_file is not None:
|
29 |
-
df = load_data(uploaded_file)
|
30 |
-
st.write(df.head())
|
31 |
|
32 |
# Load tokenizer and model
|
33 |
model_cp = "aidan-o-brien/recipe-improver"
|
@@ -35,7 +30,17 @@ tokenizer_cp = "albert-base-v2"
|
|
35 |
question_answer = load_pipeline(model_cp, tokenizer_cp)
|
36 |
st.write("Model and tokenizer successfully loaded.")
|
37 |
|
38 |
-
# Run inference
|
39 |
-
first_example = df['review'][0]
|
40 |
|
41 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
st.set_page_config(page_title=title, page_icon=icon)
|
24 |
st.title(title)
|
25 |
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
# Load tokenizer and model
|
28 |
model_cp = "aidan-o-brien/recipe-improver"
|
|
|
30 |
question_answer = load_pipeline(model_cp, tokenizer_cp)
|
31 |
st.write("Model and tokenizer successfully loaded.")
|
32 |
|
|
|
|
|
33 |
|
34 |
+
# Load csv
|
35 |
+
uploaded_file = st.file_uploader("Choose a csv file", type="csv", key='file_uploader')
|
36 |
+
if uploaded_file is not None:
|
37 |
+
df = load_data(uploaded_file)
|
38 |
+
st.write(df.head())
|
39 |
+
|
40 |
+
# Run inference on first example
|
41 |
+
first_example = df['review'][0]
|
42 |
+
question = "how to improve this recipe?"
|
43 |
+
answer = question_answer(question=question, context=first_example)
|
44 |
+
|
45 |
+
# Present results
|
46 |
+
st.write(answer)
|