This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
speech_recognizer = sr.Recognizer() | |
tokenizer = RegexpTokenizer(r'\w+') | |
def transcribe_audio(path): | |
audio = AudioSegment.from_wav(path) | |
file_name = os.path.basename(path) | |
chunks = split_on_silence(audio, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import demo.entities.ServerRecord; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.stereotype.Service; | |
import javax.persistence.EntityManager; | |
import javax.persistence.Tuple; | |
import javax.persistence.TupleElement; | |
import javax.persistence.TypedQuery; | |
import javax.persistence.criteria.CriteriaBuilder; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
import 'package:http/http.dart' as http; | |
import 'dart:convert' as convert; | |
class BackendService { | |
static Future<List<Map<String, String>>> getSuggestions(String query) async { | |
if (query.isEmpty && query.length < 3) { | |
print('Query needs to be at least 3 chars'); | |
return Future.value([]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:flutter_typeahead/flutter_typeahead.dart'; | |
import 'data.dart'; | |
class MyMaterialApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Flutter Datamuse Autocomplete Demo', | |
home: MyHomePage(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import itertools | |
import pinecone | |
from sentence_transformers import SentenceTransformer | |
api_key = "YOUR API KEY FROM PINECONE CONSOLE" | |
pinecone.init(api_key=api_key, environment='us-west1-gcp') | |
index_name = "question-answering" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static int generateNumberFromRange(int maxRange) throws NoSuchAlgorithmException { | |
Random rand = SecureRandom.getInstanceStrong(); | |
int randomNum; | |
if (maxRange == 100) { | |
randomNum = rand.nextInt(maxRange / 2) * 2; | |
} else { | |
randomNum = rand.nextInt(maxRange / 2) * 2 + 1; | |
} | |
return randomNum; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SpringBootApplication | |
public class KafkaErrorHandlingApplication { | |
public static void main(String[] args) { | |
SpringApplication.run(KafkaErrorHandlingApplication.class, args); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RestController | |
@RequiredArgsConstructor | |
@Slf4j | |
public class ProducerController { | |
private final KafkaTemplate<String, String> kafkaTemplate; | |
@Value("${topic}") | |
private String topic; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component | |
@Slf4j | |
public class MyKafkaListener { | |
@RetryableTopic( | |
attempts = "5", | |
topicSuffixingStrategy = TopicSuffixingStrategy.SUFFIX_WITH_INDEX_VALUE, | |
backoff = @Backoff(delay = 1000, multiplier = 2.0), | |
exclude = {SerializationException.class, DeserializationException.class} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
topic: my-topic | |
server: | |
port: 8090 | |
spring: | |
kafka: | |
bootstrap-servers: http://localhost:29092 | |
properties: | |
spring.deserializer.value.delegate.class: org.springframework.kafka.support.serializer.JsonDeserializer | |
security.protocol: PLAINTEXT |
NewerOlder