jmisak commited on
Commit
f0fd397
Β·
verified Β·
1 Parent(s): b81ee10

Upload 3 files

Browse files
Files changed (3) hide show
  1. CHECK_APP_PY.txt +45 -0
  2. FINAL_UPLOAD_INSTRUCTIONS.txt +118 -0
  3. app.py +31 -2
CHECK_APP_PY.txt ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ================================================================================
2
+ HOW TO VERIFY YOU HAVE THE CORRECT app.py
3
+ ================================================================================
4
+
5
+ Open app.py in a text editor and search for these lines:
6
+
7
+ 1. Search for "log_transcript_start"
8
+ βœ… Should find it around line 36
9
+ ❌ If not found = WRONG FILE!
10
+
11
+ 2. Search for "log_transcript_complete"
12
+ βœ… Should find it around line 38
13
+ ❌ If not found = WRONG FILE!
14
+
15
+ 3. Search for "def measure(self, name):"
16
+ βœ… Should find it around line 63
17
+ ❌ If not found = WRONG FILE!
18
+
19
+ If ANY of these are missing, you have the OLD version!
20
+
21
+ ================================================================================
22
+ QUICK FILE SIZE CHECK
23
+ ================================================================================
24
+
25
+ The CORRECT app.py should be approximately:
26
+ - 25-30 KB in size
27
+ - 750-850 lines long
28
+
29
+ If your app.py is much smaller, you have the wrong version!
30
+
31
+ ================================================================================
32
+ WHERE TO GET THE CORRECT FILE
33
+ ================================================================================
34
+
35
+ Location: /home/john/TranscriptorEnhanced/app.py
36
+
37
+ Make sure you're not uploading from:
38
+ ❌ Downloads folder
39
+ ❌ Desktop
40
+ ❌ Temp folder
41
+ ❌ Any backup or old location
42
+
43
+ Upload from the TranscriptorEnhanced directory ONLY!
44
+
45
+ ================================================================================
FINAL_UPLOAD_INSTRUCTIONS.txt ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ================================================================================
2
+ FINAL UPLOAD INSTRUCTIONS - ALL ISSUES FIXED
3
+ ================================================================================
4
+
5
+ IMPORTANT: You MUST upload the UPDATED app.py file!
6
+
7
+ The file has been fixed with ALL missing methods added to stub classes.
8
+
9
+ ================================================================================
10
+ STEP 1: VERIFY YOU HAVE THE CORRECT FILE
11
+ ================================================================================
12
+
13
+ Open app.py and check lines 13-71. You should see:
14
+
15
+ Line 13: # Optional: Production logging for session tracking
16
+ Line 14: try:
17
+ Line 15: from production_logger import ...
18
+
19
+ And around line 36-46 you should see these methods:
20
+ - log_warning()
21
+ - log_transcript_start()
22
+ - log_transcript_complete()
23
+ - log_transcript_error()
24
+ - log_quote_extraction()
25
+ - finalize_session()
26
+
27
+ If you DON'T see these methods, you have the wrong file!
28
+
29
+ ================================================================================
30
+ STEP 2: UPLOAD TO HUGGINGFACE SPACES
31
+ ================================================================================
32
+
33
+ Required files (9 minimum):
34
+
35
+ 1. app.py ← MUST be the NEW version with complete stub classes!
36
+ 2. llm.py
37
+ 3. extractors.py
38
+ 4. tagging.py
39
+ 5. chunking.py
40
+ 6. validation.py
41
+ 7. reporting.py
42
+ 8. dashboard.py
43
+ 9. requirements.txt
44
+
45
+ Optional files:
46
+ 10. production_logger.py (if available)
47
+ 11. quote_extractor.py (if available)
48
+
49
+ ================================================================================
50
+ STEP 3: SPACE SETTINGS
51
+ ================================================================================
52
+
53
+ SDK: Gradio
54
+ Hardware: GPU (T4) ← REQUIRED for good performance
55
+
56
+ ================================================================================
57
+ WHAT'S BEEN FIXED
58
+ ================================================================================
59
+
60
+ βœ… Import errors - quote_extractor and production_logger are now optional
61
+ βœ… AttributeError - All missing methods added to stub classes:
62
+ - log_warning()
63
+ - log_transcript_start()
64
+ - log_transcript_complete()
65
+ - log_transcript_error()
66
+ - log_quote_extraction()
67
+ - finalize_session()
68
+ - PerformanceMonitor.measure() context manager
69
+
70
+ βœ… Local model inference - Phi-3-mini configured
71
+ βœ… Quality Score 0.00 - Fixed hardcoded config issues
72
+
73
+ ================================================================================
74
+ VERIFICATION AFTER UPLOAD
75
+ ================================================================================
76
+
77
+ After uploading, check the Logs tab. You should see:
78
+
79
+ ⚠️ Production logging not available - using basic logging
80
+ ⚠️ Quote extraction not available - reports will not include storytelling quotes
81
+ βœ… Configuration loaded for HuggingFace Spaces
82
+ πŸš€ TranscriptorAI Enterprise - LLM Backend: local
83
+ [Local Model] Loading microsoft/Phi-3-mini-4k-instruct...
84
+ [Local Model] βœ… Model loaded on cuda:0
85
+
86
+ These warnings are NORMAL and OK if you only uploaded 9 files!
87
+
88
+ ================================================================================
89
+ EXPECTED BEHAVIOR
90
+ ================================================================================
91
+
92
+ The app will work WITHOUT production_logger.py and quote_extractor.py!
93
+
94
+ Instead of full logging, you'll see:
95
+ [INFO] Processing started: filename.docx
96
+ [INFO] Processing complete: filename.docx | Quality: 0.85
97
+ [INFO] Session complete
98
+
99
+ This is perfectly fine for basic usage!
100
+
101
+ ================================================================================
102
+ FILE LOCATION
103
+ ================================================================================
104
+
105
+ Make sure you're uploading from:
106
+ /home/john/TranscriptorEnhanced/app.py
107
+
108
+ NOT from any backup, cache, or old location!
109
+
110
+ ================================================================================
111
+ READY TO UPLOAD!
112
+ ================================================================================
113
+
114
+ The file is NOW ready. Upload it to HuggingFace Spaces.
115
+
116
+ If you still get AttributeError, you uploaded the wrong file!
117
+
118
+ ================================================================================
app.py CHANGED
@@ -19,6 +19,8 @@ except ImportError:
19
  print("⚠️ Production logging not available - using basic logging")
20
 
21
  # Stub classes when production_logger is not available
 
 
22
  class ProductionLogger:
23
  def __init__(self, session_id):
24
  self.session_id = session_id
@@ -29,14 +31,41 @@ except ImportError:
29
  print(f"[WARNING] {msg}")
30
  def error(self, msg):
31
  print(f"[ERROR] {msg}")
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
  class PerformanceMonitor:
34
  def __init__(self, logger):
35
  self.logger = logger
 
36
  def start_timer(self, name):
37
- pass
 
38
  def end_timer(self, name):
39
- pass
 
 
 
 
 
 
 
 
 
 
 
 
40
 
41
  def init_session(session_id):
42
  return ProductionLogger(session_id)
 
19
  print("⚠️ Production logging not available - using basic logging")
20
 
21
  # Stub classes when production_logger is not available
22
+ from contextlib import contextmanager
23
+
24
  class ProductionLogger:
25
  def __init__(self, session_id):
26
  self.session_id = session_id
 
31
  print(f"[WARNING] {msg}")
32
  def error(self, msg):
33
  print(f"[ERROR] {msg}")
34
+ def log_warning(self, msg):
35
+ print(f"[WARNING] {msg}")
36
+ def log_transcript_start(self, file_name, file_type, interviewee_type):
37
+ print(f"[INFO] Processing started: {file_name}")
38
+ def log_transcript_complete(self, file_name, quality_score, word_count, processing_time):
39
+ print(f"[INFO] Processing complete: {file_name} | Quality: {quality_score:.2f}")
40
+ def log_transcript_error(self, file_name, error_type, error_details):
41
+ print(f"[ERROR] Processing failed: {file_name} - {error_type}")
42
+ def log_quote_extraction(self, quote_count, top_score, themes):
43
+ print(f"[INFO] Quote extraction complete: {quote_count} quotes")
44
+ def finalize_session(self):
45
+ print(f"[INFO] Session {self.session_id} complete")
46
+ return {}
47
 
48
  class PerformanceMonitor:
49
  def __init__(self, logger):
50
  self.logger = logger
51
+ self.timers = {}
52
  def start_timer(self, name):
53
+ import time
54
+ self.timers[name] = time.time()
55
  def end_timer(self, name):
56
+ import time
57
+ if name in self.timers:
58
+ elapsed = time.time() - self.timers[name]
59
+ del self.timers[name]
60
+ return elapsed
61
+ return 0
62
+ @contextmanager
63
+ def measure(self, name):
64
+ self.start_timer(name)
65
+ try:
66
+ yield
67
+ finally:
68
+ self.end_timer(name)
69
 
70
  def init_session(session_id):
71
  return ProductionLogger(session_id)