szili2011 commited on
Commit
20135b2
1 Parent(s): 9b14df9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -6
app.py CHANGED
@@ -13,20 +13,27 @@ st.subheader("Generate Custom FNaF Phone Calls")
13
  # User inputs
14
  night = st.selectbox("Select the Night", ["1", "2", "3", "4", "5", "6", "7"])
15
  tone = st.selectbox("Select the Tone of the Call", ["Friendly", "Warning", "Ominous", "Neutral"])
16
- length = st.slider("Select the Length of the Call (in words)", 50, 300, 150)
17
  include_phrase = st.text_input("Include a Specific Phrase (Optional)")
18
 
19
  # Generate phone call
20
  if st.button("Generate Phone Call"):
21
- # Construct the prompt based on user input
22
- prompt = f"Generate Custom FNaF Phone Call for night {night}. The tone should be {tone.lower()}."
23
  if include_phrase:
24
- prompt += f" Make sure to include the phrase: '{include_phrase}'."
25
-
 
26
  # Generate the text
27
  result = generator(prompt, max_length=length, num_return_sequences=1)
28
  generated_text = result[0]['generated_text']
29
-
 
 
 
 
 
 
30
  # Display the generated phone call
31
  st.text(generated_text)
32
 
 
13
  # User inputs
14
  night = st.selectbox("Select the Night", ["1", "2", "3", "4", "5", "6", "7"])
15
  tone = st.selectbox("Select the Tone of the Call", ["Friendly", "Warning", "Ominous", "Neutral"])
16
+ length = st.slider("Select the Length of the Call (in words)", 50, 150, 100)
17
  include_phrase = st.text_input("Include a Specific Phrase (Optional)")
18
 
19
  # Generate phone call
20
  if st.button("Generate Phone Call"):
21
+ # Construct a more detailed prompt
22
+ prompt = f"You are the Phone Guy from Five Nights at Freddy's. Your job is to give a phone call to the night guard on night {night}. The tone should be {tone.lower()}."
23
  if include_phrase:
24
+ prompt += f" Include the following phrase in the call: '{include_phrase}'."
25
+ prompt += " Keep the call focused on advice for the night guard to survive the night, including any warnings about the animatronics. Make sure the content is spooky and coherent."
26
+
27
  # Generate the text
28
  result = generator(prompt, max_length=length, num_return_sequences=1)
29
  generated_text = result[0]['generated_text']
30
+
31
+ # Post-processing: Remove unwanted parts
32
+ unwanted_phrases = ["Make sure", "please let", "If you have any questions", "To use a phone call"]
33
+ for phrase in unwanted_phrases:
34
+ if phrase in generated_text:
35
+ generated_text = generated_text.split(phrase)[0].strip()
36
+
37
  # Display the generated phone call
38
  st.text(generated_text)
39