Spaces:
Runtime error
Runtime error
Commit
·
72c8a31
1
Parent(s):
d2042b3
generation description out of picture
Browse files
app.py
CHANGED
@@ -6,6 +6,7 @@ import torch
|
|
6 |
st.set_page_config(layout="wide")
|
7 |
|
8 |
image_pipe = pipeline("image-classification")
|
|
|
9 |
k2t_tokenizer = AutoTokenizer.from_pretrained("mrm8488/t5-base-finetuned-common_gen")
|
10 |
k2t_model = AutoModelWithLMHead.from_pretrained("mrm8488/t5-base-finetuned-common_gen")
|
11 |
|
@@ -32,6 +33,8 @@ with Image.open(img) as img:
|
|
32 |
keywords = ""
|
33 |
for keyword in results:
|
34 |
keywords += keyword["label"].split(',')[0]
|
|
|
|
|
35 |
|
36 |
col1, col2 = st.columns(2)
|
37 |
|
@@ -41,4 +44,4 @@ with Image.open(img) as img:
|
|
41 |
|
42 |
with col2:
|
43 |
st.subheader("Classification results")
|
44 |
-
st.write(
|
|
|
6 |
st.set_page_config(layout="wide")
|
7 |
|
8 |
image_pipe = pipeline("image-classification")
|
9 |
+
text_pipe = pipeline("text-generation")
|
10 |
k2t_tokenizer = AutoTokenizer.from_pretrained("mrm8488/t5-base-finetuned-common_gen")
|
11 |
k2t_model = AutoModelWithLMHead.from_pretrained("mrm8488/t5-base-finetuned-common_gen")
|
12 |
|
|
|
33 |
keywords = ""
|
34 |
for keyword in results:
|
35 |
keywords += keyword["label"].split(',')[0]
|
36 |
+
|
37 |
+
post_text = text_pipe(gen_sentence(keywords))[0]["generated_text"]
|
38 |
|
39 |
col1, col2 = st.columns(2)
|
40 |
|
|
|
44 |
|
45 |
with col2:
|
46 |
st.subheader("Classification results")
|
47 |
+
st.write(post_text)
|