Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,9 +1,12 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
| 2 |
|
| 3 |
lpmc_client = gr.load("seungheondoh/LP-Music-Caps-demo", src="spaces")
|
|
|
|
| 4 |
from gradio_client import Client
|
| 5 |
|
| 6 |
-
client = Client("https://
|
| 7 |
|
| 8 |
from diffusers import DiffusionPipeline
|
| 9 |
import torch
|
|
@@ -59,20 +62,23 @@ def infer(audio_file):
|
|
| 59 |
#print(f"SUMMARY: {summary_result}")
|
| 60 |
|
| 61 |
llama_q = f"""
|
| 62 |
-
|
|
|
|
| 63 |
I'll give you music description, then i want you to provide an illustrative image description that would fit well with the music.
|
| 64 |
|
| 65 |
Answer with only one image description. Never do lists. Do not processs each segment, but provide a summary for the whole instead.
|
| 66 |
|
| 67 |
Here's the music description :
|
| 68 |
|
|
|
|
|
|
|
| 69 |
{cap_result}
|
| 70 |
|
| 71 |
"""
|
| 72 |
|
| 73 |
result = client.predict(
|
| 74 |
llama_q, # str in 'Message' Textbox component
|
| 75 |
-
api_name="/
|
| 76 |
)
|
| 77 |
|
| 78 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import os
|
| 3 |
+
hf_token = os.environ.get('HF_TOKEN')
|
| 4 |
|
| 5 |
lpmc_client = gr.load("seungheondoh/LP-Music-Caps-demo", src="spaces")
|
| 6 |
+
|
| 7 |
from gradio_client import Client
|
| 8 |
|
| 9 |
+
client = Client("https://fffiloni-test-llama-api.hf.space/", api_key=hf_token)
|
| 10 |
|
| 11 |
from diffusers import DiffusionPipeline
|
| 12 |
import torch
|
|
|
|
| 62 |
#print(f"SUMMARY: {summary_result}")
|
| 63 |
|
| 64 |
llama_q = f"""
|
| 65 |
+
[INST] <<SYS>>\n
|
| 66 |
+
|
| 67 |
I'll give you music description, then i want you to provide an illustrative image description that would fit well with the music.
|
| 68 |
|
| 69 |
Answer with only one image description. Never do lists. Do not processs each segment, but provide a summary for the whole instead.
|
| 70 |
|
| 71 |
Here's the music description :
|
| 72 |
|
| 73 |
+
\n<</SYS>>\n\n{} [/INST]
|
| 74 |
+
|
| 75 |
{cap_result}
|
| 76 |
|
| 77 |
"""
|
| 78 |
|
| 79 |
result = client.predict(
|
| 80 |
llama_q, # str in 'Message' Textbox component
|
| 81 |
+
api_name="/predict"
|
| 82 |
)
|
| 83 |
|
| 84 |
|