jasonlawAI79 commited on
Commit
5d732ff
·
verified ·
1 Parent(s): a0e9412

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -1,13 +1,17 @@
1
  import gradio as gr
2
  import os
3
- from typing import Dict
4
- import re
5
 
6
- # Configure Modal authentication from HF Secrets
7
  if 'MODAL_TOKEN' in os.environ:
 
 
 
8
  print("✅ Modal token configured from HF Secrets")
9
  else:
10
  print("❌ MODAL_TOKEN not found in environment")
 
 
 
 
11
 
12
 
13
  # Try to import Modal for calling deployed functions
@@ -143,7 +147,7 @@ def call_modal_ai_generation(lyrics: str, artist_name: str, song_title: str) ->
143
  """Call the deployed Modal AI generation function"""
144
  try:
145
  # Look up the deployed Modal function
146
- generate_ai_content = Function.lookup("content-creation-backend", "generate_content_with_llm")
147
  result = generate_ai_content.remote(lyrics, artist_name, song_title)
148
  return result
149
  except Exception as e:
@@ -154,7 +158,7 @@ def call_modal_template_generation(lyrics: str, artist_name: str, song_title: st
154
  """Call the deployed Modal template generation function"""
155
  try:
156
  # Look up the deployed Modal function
157
- generate_template_content = Function.lookup("content-creation-backend", "generate_fallback_content")
158
  result = generate_template_content.remote(lyrics, artist_name, song_title)
159
  return result
160
  except Exception as e:
 
1
  import gradio as gr
2
  import os
 
 
3
 
 
4
  if 'MODAL_TOKEN' in os.environ:
5
+ # Set the Modal token for authentication
6
+ import modal
7
+ modal.config.set_credential("MODAL_TOKEN_ID", os.environ['MODAL_TOKEN'])
8
  print("✅ Modal token configured from HF Secrets")
9
  else:
10
  print("❌ MODAL_TOKEN not found in environment")
11
+
12
+ from typing import Dict
13
+ import re
14
+
15
 
16
 
17
  # Try to import Modal for calling deployed functions
 
147
  """Call the deployed Modal AI generation function"""
148
  try:
149
  # Look up the deployed Modal function
150
+ generate_ai_content = Function.from_name("content-creation-backend", "generate_content_with_llm")
151
  result = generate_ai_content.remote(lyrics, artist_name, song_title)
152
  return result
153
  except Exception as e:
 
158
  """Call the deployed Modal template generation function"""
159
  try:
160
  # Look up the deployed Modal function
161
+ generate_template_content = Function.from_name("content-creation-backend", "generate_fallback_content")
162
  result = generate_template_content.remote(lyrics, artist_name, song_title)
163
  return result
164
  except Exception as e: