Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Audio Detection Test</title>
</head>
<body>
<h1>Audio Detection Test</h1>
<button id="startRecording">Start Recording</button>
server {
listen 80;
server_name lipsync.uwc.world;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
import pandas as pd
from sentence_transformers import SentenceTransformer
from sklearn.metrics.pairwise import cosine_similarity
import numpy as np
import torch
# Clear unused GPU memory
torch.cuda.empty_cache()
def calculate_cosine_similarity(sentences1, sentences2):
from kafka import KafkaProducer
from kafka.errors import KafkaError
# Kafka broker configuration
bootstrap_servers = 'localhost:9092'
topic = 'your_topic'
# SSL configuration
ssl_cafile = '/home/uwc/kafka-ssl-compose/secrets/broker.truststore.jks'
ssl_certfile = '/home/uwc/kafka-ssl-compose/secrets/broker.keystore.jks'
server {
# set proper server name after domain set
server_name s2t.uwc.world;
location / {
proxy_pass http://127.0.0.1:8000;
# by default, do not forward anything
from kafka import KafkaConsumer
# Kafka consumer configuration
bootstrap_servers = 'localhost:9092'
topic = 'newteststellacoqui'
# Create Kafka consumer
consumer = KafkaConsumer(topic, bootstrap_servers=bootstrap_servers, auto_offset_reset='latest')
# Consume messages from Kafka
import subprocess
import os
from fastapi import FastAPI, File, UploadFile
from base64 import b64encode
app = FastAPI()
checkpoint_path = "/home/uwcuser/wav2lip/Wav2Lip/checkpoints/wav2lip_gan.pth"
face_video_path = "/home/uwcuser/wav2lip/sample/promila.mp4"
import requests
url = 'https://s2t.uwc.world/transcribe'
headers = {
'accept': 'application/json'
}
# Set up the file to be uploaded
files = {
'file': ('audio.mp3', open('/home/pr0mila/PycharmProjects/pythonProject1/audio.mp3', 'rb'), 'audio/mpeg')
prompt 1 = "Your task is to generate a short summary of each answer to the questions reviewed from an mental health site. mention when the answer is blank. The output will be as a paragraph based on the answers. Example " Patient name is Alice. She likes to watch movie etc" question1: What is your name? Answer 1: My name is Alice, question2: Who is your favourite personality? Answer 2: , question3: How was your day? Good, bad or something else? Answer 3: Fine as usual, question 4: Please share your favourite teacher's name. Answer3: John Doe"
From Chat GPT Summarizer1
Based on the answers provided on the mental health site, the following summary can be generated:
The patient's name is Alice. She shared that her day was fine as usual, but she did not mention her favorite personality. Additionally, she did not provide a response when asked about her favorite teacher's name.
from fastapi import FastAPI
from deepface import DeepFace
from TTS.utils.manage import ModelManager
from TTS.utils.synthesizer import Synthesizer
from tensorflow.python.client._pywrap_tf_session import *
import whisper
import site
import tensorflow as tf
import torch