NeoPy commited on
Commit
59937e3
·
verified ·
1 Parent(s): 9ed0ca1

Update cover.py

Browse files
Files changed (1) hide show
  1. cover.py +4 -7
cover.py CHANGED
@@ -9,7 +9,7 @@ from telegram.ext import ContextTypes
9
  from main import song_cover_pipeline # Keeping this import from your original main.py
10
  from webui import download_online_model # Import the download function
11
 
12
- Define paths
13
 
14
  BASE_DIR = os.path.dirname(os.path.abspath(file))
15
  output_dir = os.path.join(BASE_DIR, 'song_output')
@@ -18,7 +18,7 @@ Ensure the output directory exists
18
 
19
  os.makedirs(output_dir, exist_ok=True)
20
 
21
- Start command
22
 
23
  async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
24
  keyboard = [
@@ -29,7 +29,6 @@ keyboard = [
29
  reply_markup = InlineKeyboardMarkup(keyboard)
30
  await update.message.reply_text('Welcome to AICoverGen! Choose an option below:', reply_markup=reply_markup)
31
 
32
- Button handler
33
 
34
  async def button(update: Update, context: ContextTypes.DEFAULT_TYPE):
35
  query = update.callback_query
@@ -59,7 +58,7 @@ elif query.data == 'help':
59
  )
60
  await query.edit_message_text(text=help_text)
61
 
62
- Message handler
63
 
64
  async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE):
65
  # Check which mode the user is in based on previous button choice
@@ -75,7 +74,7 @@ else:
75
  # If no mode is selected, ask the user to choose an option
76
  await update.message.reply_text("Please choose an option first by clicking 'Generate Song' or 'Download Model'.")
77
 
78
- Generate song handler
79
 
80
  async def generate_song(update: Update, context: ContextTypes.DEFAULT_TYPE):
81
  song_input = update.message.text
@@ -97,7 +96,6 @@ if os.path.exists(song_output):
97
  else:
98
  await update.message.reply_text(f"An error occurred while generating the song.")
99
 
100
- Download model handler with custom name
101
 
102
  async def download_model(update: Update, context: ContextTypes.DEFAULT_TYPE):
103
  model_input = update.message.text
@@ -119,7 +117,6 @@ try:
119
  except Exception as e:
120
  await update.message.reply_text(f"Failed to download the model. Error: {str(e)}")
121
 
122
- Main function to run the bot
123
 
124
  def main():
125
  bot_token = "7722898432:AAEfj9s6ubY107SWiF6Uy1IKJFFmsiqY_BA"
 
9
  from main import song_cover_pipeline # Keeping this import from your original main.py
10
  from webui import download_online_model # Import the download function
11
 
12
+
13
 
14
  BASE_DIR = os.path.dirname(os.path.abspath(file))
15
  output_dir = os.path.join(BASE_DIR, 'song_output')
 
18
 
19
  os.makedirs(output_dir, exist_ok=True)
20
 
21
+
22
 
23
  async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
24
  keyboard = [
 
29
  reply_markup = InlineKeyboardMarkup(keyboard)
30
  await update.message.reply_text('Welcome to AICoverGen! Choose an option below:', reply_markup=reply_markup)
31
 
 
32
 
33
  async def button(update: Update, context: ContextTypes.DEFAULT_TYPE):
34
  query = update.callback_query
 
58
  )
59
  await query.edit_message_text(text=help_text)
60
 
61
+
62
 
63
  async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE):
64
  # Check which mode the user is in based on previous button choice
 
74
  # If no mode is selected, ask the user to choose an option
75
  await update.message.reply_text("Please choose an option first by clicking 'Generate Song' or 'Download Model'.")
76
 
77
+
78
 
79
  async def generate_song(update: Update, context: ContextTypes.DEFAULT_TYPE):
80
  song_input = update.message.text
 
96
  else:
97
  await update.message.reply_text(f"An error occurred while generating the song.")
98
 
 
99
 
100
  async def download_model(update: Update, context: ContextTypes.DEFAULT_TYPE):
101
  model_input = update.message.text
 
117
  except Exception as e:
118
  await update.message.reply_text(f"Failed to download the model. Error: {str(e)}")
119
 
 
120
 
121
  def main():
122
  bot_token = "7722898432:AAEfj9s6ubY107SWiF6Uy1IKJFFmsiqY_BA"