Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -37,8 +37,26 @@ if writingPrompt:
|
|
| 37 |
response_content = ""
|
| 38 |
for chunk in stream:
|
| 39 |
response_content += chunk.choices[0].delta.content
|
| 40 |
-
|
| 41 |
st.write(response_content)
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
#Image generation
|
| 44 |
summary = summarizer(response_content, max_length=130, min_length=30, do_sample=False)
|
|
|
|
| 37 |
response_content = ""
|
| 38 |
for chunk in stream:
|
| 39 |
response_content += chunk.choices[0].delta.content
|
| 40 |
+
|
| 41 |
st.write(response_content)
|
| 42 |
|
| 43 |
+
st.write("Here's some more information to get you started:")
|
| 44 |
+
|
| 45 |
+
messages2 = [{ "role": "user", "content": f"Who are the main characters in this text, what are some key locations that should be included, and what are the main story beats of this text: {response_content}"}]
|
| 46 |
+
|
| 47 |
+
stream2 = client.chat.completions.create(
|
| 48 |
+
model="microsoft/Phi-3.5-mini-instruct",
|
| 49 |
+
messages=messages2,
|
| 50 |
+
max_tokens=500,
|
| 51 |
+
stream=True
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
#Output response
|
| 55 |
+
response_content_2 = ""
|
| 56 |
+
for chunk in stream2:
|
| 57 |
+
response_content_2 += chunk.choices[0].delta.content
|
| 58 |
+
|
| 59 |
+
st.write(response_content_2)
|
| 60 |
+
|
| 61 |
#Image generation
|
| 62 |
summary = summarizer(response_content, max_length=130, min_length=30, do_sample=False)
|