Bils commited on
Commit
94f073d
·
verified ·
1 Parent(s): 698fd0e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -41,15 +41,15 @@ def generate_script(user_prompt: str, model_id: str, token: str, duration: int):
41
  )
42
 
43
  combined_prompt = f"{system_prompt}\nUser concept: {user_prompt}\nRefined script and music suggestion:"
44
- result = llama_pipeline(combined_prompt, max_new_tokens=200, do_sample=True, temperature=0.9)
45
 
46
- # Ensure the output contains the expected structure
47
  generated_text = result[0]["generated_text"]
48
  if "Music Suggestion:" in generated_text:
49
  script, music_suggestion = generated_text.split("Music Suggestion:", 1)
50
  return script.strip(), music_suggestion.strip()
51
  else:
52
- # Fallback if the output format isn't as expected
53
  return generated_text.strip(), "No specific music suggestion found."
54
  except Exception as e:
55
  return f"Error generating script: {e}", None
 
41
  )
42
 
43
  combined_prompt = f"{system_prompt}\nUser concept: {user_prompt}\nRefined script and music suggestion:"
44
+ result = llama_pipeline(combined_prompt, max_new_tokens=500, do_sample=True, temperature=0.9)
45
 
46
+ # Check if the output contains "Music Suggestion:"
47
  generated_text = result[0]["generated_text"]
48
  if "Music Suggestion:" in generated_text:
49
  script, music_suggestion = generated_text.split("Music Suggestion:", 1)
50
  return script.strip(), music_suggestion.strip()
51
  else:
52
+ # Return the full text as the script and indicate no music suggestion was found
53
  return generated_text.strip(), "No specific music suggestion found."
54
  except Exception as e:
55
  return f"Error generating script: {e}", None