added llama
Browse files
app.py
CHANGED
@@ -21,7 +21,7 @@ if uploaded_img is not None:
|
|
21 |
st.write("Caption:", caption)
|
22 |
|
23 |
character_prompts = {
|
24 |
-
"rapper": f"Describe this scene like you're a rapper
|
25 |
"monkey": f"Describe this scene like you're a monkey going bananas: {caption}.",
|
26 |
"shrek": f"Describe this scene like you're Shrek: {caption}.",
|
27 |
"unintelligible": f"Describe this scene in a way that makes no sense: {caption}."
|
@@ -32,3 +32,14 @@ if uploaded_img is not None:
|
|
32 |
|
33 |
personality = "rapper"
|
34 |
prompt = character_prompts[personality]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
st.write("Caption:", caption)
|
22 |
|
23 |
character_prompts = {
|
24 |
+
"rapper": f"Describe this scene like you're a rapper: {caption}.",
|
25 |
"monkey": f"Describe this scene like you're a monkey going bananas: {caption}.",
|
26 |
"shrek": f"Describe this scene like you're Shrek: {caption}.",
|
27 |
"unintelligible": f"Describe this scene in a way that makes no sense: {caption}."
|
|
|
32 |
|
33 |
personality = "rapper"
|
34 |
prompt = character_prompts[personality]
|
35 |
+
|
36 |
+
|
37 |
+
|
38 |
+
text_generator = pipeline("text-generation", model="meta-llama/Llama-2-7b-hf")
|
39 |
+
|
40 |
+
prompt = character_prompts[character]
|
41 |
+
st.write("Styled Prompt:", prompt)
|
42 |
+
|
43 |
+
generated_text = text_generator(prompt, max_length=50, do_sample=True)
|
44 |
+
styled_caption = generated_text[0]['generated_text']
|
45 |
+
st.write("Character-Styled Caption:", styled_caption)
|