Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -827,27 +827,35 @@ logger.info("Creating global ModelManager instance.")
|
|
827 |
model_manager = ModelManager()
|
828 |
|
829 |
|
830 |
-
@spaces.GPU(duration=
|
831 |
def generate_news(instructions, facts, size, tone, *args):
|
832 |
-
"""Generate a news article based on provided data using an LLM."""
|
833 |
request_start_time = time.time()
|
834 |
-
logger.info("--- generate_news function started ---")
|
835 |
-
|
836 |
-
|
|
|
837 |
|
|
|
838 |
try:
|
839 |
-
|
840 |
-
#
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
851 |
|
852 |
# --- Argument Parsing ---
|
853 |
# (Same as before)
|
|
|
827 |
model_manager = ModelManager()
|
828 |
|
829 |
|
830 |
+
@spaces.GPU(duration=10) # Duraci贸n corta solo para prueba
|
831 |
def generate_news(instructions, facts, size, tone, *args):
|
|
|
832 |
request_start_time = time.time()
|
833 |
+
logger.info("--- generate_news function started (SIMPLIFIED DEBUG VERSION) ---")
|
834 |
+
generated_article = "Debug: Simplified function executed."
|
835 |
+
raw_transcriptions = f"Debug info:\nInstructions: {bool(instructions)}\nFacts: {bool(facts)}\nSize: {size}\nTone: {tone}\nNum args: {len(args)}"
|
836 |
+
error_to_report = None
|
837 |
|
838 |
+
# --- Comenta TODO el procesamiento y carga de modelos ---
|
839 |
try:
|
840 |
+
logger.info("Simplified version: Skipping all processing and model loading.")
|
841 |
+
# --- NO LLAMES A check_llm_initialized NI check_whisper_initialized ---
|
842 |
+
# --- NO PROCESES documents, urls, audio, social ---
|
843 |
+
# --- NO CONSTRUYAS EL PROMPT ---
|
844 |
+
# --- NO LLAMES A text_pipeline ---
|
845 |
+
pass # Simplemente no hacemos nada
|
846 |
+
|
847 |
+
except Exception as e:
|
848 |
+
total_time = time.time() - request_start_time
|
849 |
+
logger.error(f"!!! UNHANDLED Error even in SIMPLIFIED generate_news after {total_time:.2f} seconds: {str(e)}")
|
850 |
+
logger.error(traceback.format_exc())
|
851 |
+
error_to_report = f"Error in simplified function: {str(e)}"
|
852 |
+
generated_article = error_to_report
|
853 |
+
raw_transcriptions += f"\n\n[CRITICAL ERROR] Simplified execution failed: {str(e)}"
|
854 |
+
|
855 |
+
total_time = time.time() - request_start_time
|
856 |
+
logger.info(f"--- generate_news (SIMPLIFIED DEBUG VERSION) finished in {total_time:.2f} seconds. ---")
|
857 |
+
# Aseg煤rate de devolver dos strings
|
858 |
+
return generated_article, raw_transcriptions
|
859 |
|
860 |
# --- Argument Parsing ---
|
861 |
# (Same as before)
|