Monke64 commited on
Commit
b9b384d
·
1 Parent(s): a08179c

Minor changes to variables

Browse files
Files changed (1) hide show
  1. app.py +8 -9
app.py CHANGED
@@ -7,10 +7,6 @@ import tensorflow as tf
7
  import torch
8
  import os
9
 
10
- emo_list = []
11
- gen_list = []
12
- tempo_list = []
13
-
14
  physical_devices = tf.config.experimental.list_physical_devices('GPU')
15
  if len(physical_devices) > 0:
16
  tf.config.experimental.set_memory_growth(physical_devices[0], True)
@@ -45,6 +41,9 @@ if 'genre' not in st.session_state:
45
  if 'beat' not in st.session_state:
46
  st.session_state.beat = None
47
 
 
 
 
48
  emotion_service = load_emo_model()
49
  genre_service = load_genre_model()
50
  beat_service = load_beat_model()
@@ -73,16 +72,16 @@ with c3:
73
  st.text(st.session_state.beat)
74
 
75
  if st.session_state.emotion != None and st.session_state.genre != None and st.session_state.beat != None:
76
- text_output = None
77
  if st.button("Generate text description to be fed into stable diffusion"):
78
  if st.session_state.beat > 100:
79
  speed = "medium and steady"
80
  else:
81
  speed = "slow and calm"
82
  st.caption("Text description of your music file")
83
- text_output = "A scenic image that describes a " + speed + " pace with a feeling of" + st.session_state.emotion + "."
84
- st.text(text_output)
85
- if text_output:
 
86
  if st.button("Generate image from text description"):
87
- image = image_service(text_output)
88
  st.image(image)
 
7
  import torch
8
  import os
9
 
 
 
 
 
10
  physical_devices = tf.config.experimental.list_physical_devices('GPU')
11
  if len(physical_devices) > 0:
12
  tf.config.experimental.set_memory_growth(physical_devices[0], True)
 
41
  if 'beat' not in st.session_state:
42
  st.session_state.beat = None
43
 
44
+ if "text_prompt" not in st.session_state:
45
+ st.session_state.text_prompt = None
46
+
47
  emotion_service = load_emo_model()
48
  genre_service = load_genre_model()
49
  beat_service = load_beat_model()
 
72
  st.text(st.session_state.beat)
73
 
74
  if st.session_state.emotion != None and st.session_state.genre != None and st.session_state.beat != None:
 
75
  if st.button("Generate text description to be fed into stable diffusion"):
76
  if st.session_state.beat > 100:
77
  speed = "medium and steady"
78
  else:
79
  speed = "slow and calm"
80
  st.caption("Text description of your music file")
81
+ text = "A scenic image that describes a " + speed + " pace with a feeling of" + st.session_state.emotion + "."
82
+ st.session_state.text_prompt = text
83
+ st.text(st.session_state.text_prompt)
84
+ if st.session_state.text_prompt:
85
  if st.button("Generate image from text description"):
86
+ image = image_service(st.session_state.text_prompt)
87
  st.image(image)