Spaces:
Running
Running
Commit
·
b15b511
1
Parent(s):
c1b170a
remove: head and add js
Browse files
app.py
CHANGED
@@ -230,7 +230,6 @@ class TranscriptProcessor:
|
|
230 |
corrected_mapping = self.speaker_mapping
|
231 |
# Update the speaker mapping with corrected names
|
232 |
self.speaker_mapping = corrected_mapping
|
233 |
-
print("Corrected Speaker Mapping:", self.speaker_mapping)
|
234 |
|
235 |
# Update the transcript segments with corrected names
|
236 |
for segment in self.segments:
|
@@ -897,85 +896,12 @@ def create_chat_interface():
|
|
897 |
return 'Iframe handler initialized';
|
898 |
}
|
899 |
"""
|
900 |
-
head = f"""
|
901 |
-
<script defer src="https://www.gstatic.com/firebasejs/11.1.0/firebase-firestore.js"></script>
|
902 |
-
<script type="module">
|
903 |
-
// Import the functions you need from the SDKs you need
|
904 |
-
import {{ initializeApp }} from "https://www.gstatic.com/firebasejs/11.1.0/firebase-app.js";
|
905 |
-
import {{ getDatabase, ref, set }} from "https://www.gstatic.com/firebasejs/11.1.0/firebase-database.js";
|
906 |
-
// TODO: Add SDKs for Firebase products that you want to use
|
907 |
-
// https://firebase.google.com/docs/web/setup#available-libraries
|
908 |
-
|
909 |
-
// Your web app's Firebase configuration
|
910 |
-
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
|
911 |
-
const firebaseConfig = {{
|
912 |
-
apiKey: "{os.getenv('FIREBASE_API_KEY')}",
|
913 |
-
authDomain: "{os.getenv('FIREBASE_AUTH_DOMAIN')}",
|
914 |
-
databaseURL: "{os.getenv('FIREBASE_DATABASE_URL')}",
|
915 |
-
projectId: "{os.getenv('FIREBASE_PROJECT_ID')}",
|
916 |
-
storageBucket: "{os.getenv('FIREBASE_STORAGE_BUCKET')}",
|
917 |
-
messagingSenderId: "{os.getenv('FIREBASE_MESSAGING_SENDER_ID')}",
|
918 |
-
appId: "{os.getenv('FIREBASE_APP_ID')}",
|
919 |
-
measurementId: "{os.getenv('FIREBASE_MEASUREMENT_ID')}"
|
920 |
-
}};
|
921 |
-
|
922 |
-
// Initialize Firebase
|
923 |
-
const app = initializeApp(firebaseConfig);
|
924 |
-
const realtimeDB = getDatabase(app);
|
925 |
-
const rollAccount = "roll-dev-account";
|
926 |
-
const COLLECTIONS = {{
|
927 |
-
COLLAB_EDIT_LINK: "collab_link_handler",
|
928 |
-
}};
|
929 |
-
|
930 |
-
// Event listener for click
|
931 |
-
document.addEventListener('click', function (event) {{
|
932 |
-
var link = event.target.closest('a');
|
933 |
-
if (link && link.href) {{
|
934 |
-
|
935 |
-
// Parse the URL to extract 'st' and 'et'
|
936 |
-
const url = new URL(link.href);
|
937 |
-
const startTime = url.searchParams.get('st');
|
938 |
-
const endTime = url.searchParams.get('et');
|
939 |
-
const userId = url.searchParams.get('uid') || "";
|
940 |
-
|
941 |
-
if (startTime || endTime) {{
|
942 |
-
let components = url.pathname.split("/");
|
943 |
-
let callId = components[2];
|
944 |
-
let recordingSessionId = components[3];
|
945 |
-
|
946 |
-
let data = {{
|
947 |
-
startTime: parseInt(startTime, 10),
|
948 |
-
endTime: parseInt(endTime, 10),
|
949 |
-
}};
|
950 |
-
|
951 |
-
console.log("Data to save:", data);
|
952 |
-
|
953 |
-
// Firebase reference
|
954 |
-
let reference = ref(
|
955 |
-
realtimeDB,
|
956 |
-
`${{rollAccount}}/${{COLLECTIONS.COLLAB_EDIT_LINK}}/${{userId}}/${{callId}}/${{recordingSessionId}}`
|
957 |
-
);
|
958 |
-
|
959 |
-
set(reference, data)
|
960 |
-
.then(() => {{
|
961 |
-
console.log("Data saved successfully:", data);
|
962 |
-
}})
|
963 |
-
.catch((error) => {{
|
964 |
-
console.error("Error saving data:", error);
|
965 |
-
}});
|
966 |
-
}}
|
967 |
-
|
968 |
-
event.preventDefault(); // Prevent default behavior
|
969 |
-
}}
|
970 |
-
}});
|
971 |
-
</script>
|
972 |
-
"""
|
973 |
|
974 |
with gr.Blocks(
|
975 |
fill_height=True,
|
976 |
fill_width=True,
|
977 |
css=css,
|
978 |
-
|
979 |
theme=gr.themes.Default(
|
980 |
font=[gr.themes.GoogleFont("Inconsolata"), "Arial", "sans-serif"]
|
981 |
),
|
|
|
230 |
corrected_mapping = self.speaker_mapping
|
231 |
# Update the speaker mapping with corrected names
|
232 |
self.speaker_mapping = corrected_mapping
|
|
|
233 |
|
234 |
# Update the transcript segments with corrected names
|
235 |
for segment in self.segments:
|
|
|
896 |
return 'Iframe handler initialized';
|
897 |
}
|
898 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
899 |
|
900 |
with gr.Blocks(
|
901 |
fill_height=True,
|
902 |
fill_width=True,
|
903 |
css=css,
|
904 |
+
js=js,
|
905 |
theme=gr.themes.Default(
|
906 |
font=[gr.themes.GoogleFont("Inconsolata"), "Arial", "sans-serif"]
|
907 |
),
|