Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
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=
|
45 |
|
46 |
-
#
|
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 |
-
#
|
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
|