Spaces:
Runtime error
Runtime error
ChrisMofus
commited on
Commit
•
1d55ece
1
Parent(s):
abf6d13
Use model to generate story based on image description
Browse files
app.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
import einops
|
2 |
import streamlit as st
|
3 |
from PIL import Image
|
@@ -25,3 +27,10 @@ if uploaded_file is not None:
|
|
25 |
answer = model.answer_question(enc_image, "Describe this image in a few sentences.", tokenizer)
|
26 |
|
27 |
st.write(answer)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import transformers
|
2 |
+
import torch
|
3 |
import einops
|
4 |
import streamlit as st
|
5 |
from PIL import Image
|
|
|
27 |
answer = model.answer_question(enc_image, "Describe this image in a few sentences.", tokenizer)
|
28 |
|
29 |
st.write(answer)
|
30 |
+
|
31 |
+
model_id = "meta-llama/Meta-Llama-3-8B"
|
32 |
+
|
33 |
+
pipeline = transformers.pipeline("text-generation", model=model_id, model_kwargs={"torch_dtype": torch.bfloat16}, device_map="auto")
|
34 |
+
|
35 |
+
pipeline("Generate a short story based on image description: " + answer)
|
36 |
+
|