Spaces:
Sleeping
Sleeping
revert changes
Browse files
app.py
CHANGED
|
@@ -2,7 +2,7 @@ import streamlit as st
|
|
| 2 |
import spotipy
|
| 3 |
from streamlit_oauth import OAuth2Component
|
| 4 |
# from diffusers import StableDiffusionPipeline
|
| 5 |
-
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 6 |
# import torch
|
| 7 |
|
| 8 |
AUTHORIZE_URL = 'https://accounts.spotify.com/authorize'
|
|
@@ -15,8 +15,6 @@ REDIRECT_URI = 'https://huggingface.co/spaces/atepper/tracklist-analysis'
|
|
| 15 |
# REDIRECT_URI= 'http://localhost:8501'
|
| 16 |
SCOPE = st.secrets["SPOTIFY_SCOPE"]
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
oauth2 = OAuth2Component(CLIENT_ID, CLIENT_SECRET, AUTHORIZE_URL, TOKEN_URL, REFRESH_TOKEN_URL, REVOKE_TOKEN_URL)
|
| 21 |
|
| 22 |
if 'token' not in st.session_state:
|
|
@@ -50,13 +48,13 @@ else:
|
|
| 50 |
prompt = f"Generate 6 adjectives that describe the color, physical texture, taste, smell, vibe, and style of the sum of the following songs: {', '.join(entries)}. Return only the six adjectives in this form: [\"color\", \"physical texture\", \"taste\", \"smell\", \"vibe\", \"style\"]"
|
| 51 |
st.write('Prompt: ' + prompt)
|
| 52 |
|
| 53 |
-
tokenizer = AutoTokenizer.from_pretrained("google/gemma-7b-it")
|
| 54 |
-
model = AutoModelForCausalLM.from_pretrained("google/gemma-7b-it")
|
| 55 |
|
| 56 |
-
input_ids = tokenizer(prompt, return_tensors="pt")
|
| 57 |
|
| 58 |
-
outputs = model.generate(**input_ids)
|
| 59 |
-
st.write(tokenizer.decode(outputs[0]))
|
| 60 |
|
| 61 |
# model_id = "runwayml/stable-diffusion-v1-5"
|
| 62 |
# pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
|
|
|
|
| 2 |
import spotipy
|
| 3 |
from streamlit_oauth import OAuth2Component
|
| 4 |
# from diffusers import StableDiffusionPipeline
|
| 5 |
+
# from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 6 |
# import torch
|
| 7 |
|
| 8 |
AUTHORIZE_URL = 'https://accounts.spotify.com/authorize'
|
|
|
|
| 15 |
# REDIRECT_URI= 'http://localhost:8501'
|
| 16 |
SCOPE = st.secrets["SPOTIFY_SCOPE"]
|
| 17 |
|
|
|
|
|
|
|
| 18 |
oauth2 = OAuth2Component(CLIENT_ID, CLIENT_SECRET, AUTHORIZE_URL, TOKEN_URL, REFRESH_TOKEN_URL, REVOKE_TOKEN_URL)
|
| 19 |
|
| 20 |
if 'token' not in st.session_state:
|
|
|
|
| 48 |
prompt = f"Generate 6 adjectives that describe the color, physical texture, taste, smell, vibe, and style of the sum of the following songs: {', '.join(entries)}. Return only the six adjectives in this form: [\"color\", \"physical texture\", \"taste\", \"smell\", \"vibe\", \"style\"]"
|
| 49 |
st.write('Prompt: ' + prompt)
|
| 50 |
|
| 51 |
+
# tokenizer = AutoTokenizer.from_pretrained("google/gemma-7b-it")
|
| 52 |
+
# model = AutoModelForCausalLM.from_pretrained("google/gemma-7b-it")
|
| 53 |
|
| 54 |
+
# input_ids = tokenizer(prompt, return_tensors="pt")
|
| 55 |
|
| 56 |
+
# outputs = model.generate(**input_ids)
|
| 57 |
+
# st.write(tokenizer.decode(outputs[0]))
|
| 58 |
|
| 59 |
# model_id = "runwayml/stable-diffusion-v1-5"
|
| 60 |
# pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
|