Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -11,16 +11,15 @@ login(token=api_key)
|
|
11 |
|
12 |
|
13 |
# llama
|
14 |
-
pipe = pipeline(task="text-generation", model="google/gemma-2-2b-
|
15 |
-
messages = [
|
16 |
-
{"role": "system", "content": "You are a text generator that writes Shakespeare given a prompt, the text you write needs be 25 lines long. and cannot be none, you must write a poem that is 25 lines long."},
|
17 |
-
]
|
18 |
|
19 |
def poet(text):
|
20 |
-
|
|
|
21 |
outputs = pipe(messages, max_length=80)
|
22 |
-
return outputs[0]["generated_text"].strip()
|
23 |
-
|
24 |
st.title("Shakespeare Ai")
|
25 |
st.write("A space made to allow people to create shakespeare like text with images!")
|
26 |
|
|
|
11 |
|
12 |
|
13 |
# llama
|
14 |
+
pipe = pipeline(task="text-generation", model="google/gemma-2-2b-it")
|
15 |
+
messages = []
|
|
|
|
|
16 |
|
17 |
def poet(text):
|
18 |
+
prompt = 'Make 25 lines of shakespeare based on: ' + text
|
19 |
+
messages.append({"role": "user", "content": prompt})
|
20 |
outputs = pipe(messages, max_length=80)
|
21 |
+
return outputs[0]["generated_text"][-1]["content"].strip()
|
22 |
+
|
23 |
st.title("Shakespeare Ai")
|
24 |
st.write("A space made to allow people to create shakespeare like text with images!")
|
25 |
|