Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why do I need an openAIkey to run this? OPENAI_API_KEY=your_openai_api_key OPENAI_BASE_URL=your_base_url python app.py #10

Open
moreAImore opened this issue Nov 11, 2024 · 4 comments

Comments

@moreAImore
Copy link

moreAImore commented Nov 11, 2024

I just read this (OPENAI_API_KEY=your_openai_api_key OPENAI_BASE_URL=your_base_url python app.py)

Why would I need an openAI key to run this?
Cant this work locally (or least only by connecting to hugging face, no more than that)?

I don't undersyand what is the role or openAI communication?

If I can not have to use openAI key , please tell me.

Edit:
I just checked the app.py file it seems to contain some system prompt, so thats the link? OK wait, cant you make a method so instead of using the EXPENSIVE API, I could go direclty to chatgpt and talk to it and tell it exaclty as the system prompt, the come copy paste the answer to the program, so I dont have to pay this way?

Thanks

@wenqsun
Copy link
Owner

wenqsun commented Nov 12, 2024

Hi, the openai_api_key is used to enhance the prompt. Of course, you can use a local VLM to recaption. If you use that, you can just copy the prompt to the prompt area in gradio demo and comment out the OPENAI_API_KEY

@moreAImore
Copy link
Author

Of course, you can use a local VLM to recaption

Hello @wenqsun could you show me which lines of code to replace which which please? I really am not sure how to do this.
What I inteded was to go to chatgpt.com and prompt it direclty and get the answer then come back to the inference.py and insert the answer(s) somehow (hardcoded or in UI), but if you have a better solution with LLM or something I am open it, just need guidance how to do it please?
I have ollama installed if that helps?

@wenqsun
Copy link
Owner

wenqsun commented Nov 12, 2024

Hi, If you want to use the chatgpt to recaption the prompt and copy to the inference code, a simple way is to just run python app.py without the exvironmental setting. When the gradio demo comes out, just copy the prompt to the prompt area below:
image

@moreAImore
Copy link
Author

I will try again later (had trouble with space disk when installing). Hoped to get more details though, for example, what prompt shoudl I use (the one in the .py right?

But i see you have several ones:

"""You are part of a team of bots that creates videos. You work with an assistant bot that will draw anything you say in square brackets.

For example , outputting " a beautiful morning in the woods with the sun peaking through the trees " will trigger your partner bot to output an video of a forest morning , as described. You will be prompted by people looking to create detailed , amazing videos. The way to accomplish this is to take their short prompts and make them extremely detailed and descriptive.
There are a few rules to follow:

You will only ever output a single video description per user request.

When modifications are requested , you should not simply make the description longer . You should refactor the entire description to integrate the suggestions.
Other times the user will not want modifications , but instead want a new image . In this case , you should ignore your previous conversation with the user.

Video descriptions must have the same num of words as examples below. Extra words will be ignored.
"""

and

messages=[
{"role": "system", "content": sys_prompt},
{
"role": "user",
"content": 'Create an imaginative video descriptive caption or modify an earlier caption for the user input : "a girl is on the beach"',
},
{
"role": "assistant",
"content": "A radiant woman stands on a deserted beach, arms outstretched, wearing a beige trench coat, white blouse, light blue jeans, and chic boots, against a backdrop of soft sky and sea. Moments later, she is seen mid-twirl, arms exuberant, with the lighting suggesting dawn or dusk. Then, she runs along the beach, her attire complemented by an off-white scarf and black ankle boots, the tranquil sea behind her. Finally, she holds a paper airplane, her pose reflecting joy and freedom, with the ocean's gentle waves and the sky's soft pastel hues enhancing the serene ambiance.",
},
{
"role": "user",
"content": 'Create an imaginative video descriptive caption or modify an earlier caption for the user input : "A man jogging on a football field"',
},
{
"role": "assistant",
"content": "A determined man in athletic attire, including a blue long-sleeve shirt, black shorts, and blue socks, jogs around a snow-covered soccer field, showcasing his solitary exercise in a quiet, overcast setting. His long dreadlocks, focused expression, and the serene winter backdrop highlight his dedication to fitness. As he moves, his attire, consisting of a blue sports sweatshirt, black athletic pants, gloves, and sneakers, grips the snowy ground. He is seen running past a chain-link fence enclosing the playground area, with a basketball hoop and children's slide, suggesting a moment of solitary exercise amidst the empty field.",
},
{
"role": "user",
"content": 'Create an imaginative video descriptive caption or modify an earlier caption for the user input : " A woman is dancing, HD footage, close-up"',
},
{
"role": "assistant",
"content": "A young woman with her hair in an updo and wearing a teal hoodie stands against a light backdrop, initially looking over her shoulder with a contemplative expression. She then confidently makes a subtle dance move, suggesting rhythm and movement. Next, she appears poised and focused, looking directly at the camera. Her expression shifts to one of introspection as she gazes downward slightly. Finally, she dances with confidence, her left hand over her heart, symbolizing a poignant moment, all while dressed in the same teal hoodie against a plain, light-colored background.",
},
{
"role": "user",
"content": f'Create an imaginative video descriptive caption or modify an earlier caption in ENGLISH for the user input: "{text}"',
},
],

So I am not sure exaclty, the step by step workflow though? (Altho I did not install it yet to try like I explained, just wanted to be sure I succeed making work when I install it)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants